Unable to pass variable to find_element_by_link_text


#1

I’m beginner to python, trying to automate the daily download process. Filename what we want download will be different every day, so i created a property file with all the names and reading the variable required to download with for loop (date criteria)

Property file

2019-04-10=abc
2019-04-11=xyz
2019-04-15=lmn

Download script

cur_date = datetime.date.today()
cur_date.strftime(’%Y-%m-%d’)
for line in open(r’C:\Users<user>\Desktop\ConfigFile.properties’):
if cur_date.strftime(’%Y-%m-%d’) in line:
f_name=line.split("=",1)[1]
filename=f_name.strip() ## till this it works fine

now i want to pass the ‘filename’ to locator to download, with below am trying, but its not working
browser.find_element_by_link_text(filename).click()

It’s unable to read the variable ‘filename’ value, instead it assumes filename as text and trying to search filename and end up failing.

Please let me know how to do this. Thanks in advance