Reputation: 59
I have a daily FTP file that I need to grab, and I am trying to find a way to have Selenium download the new file daily.
Currently I have this line in my python script and it works fine but the file name will change daily so it will just keep grabbing that same file over and over.
driver.find_element_by_link_text("report.201606040002...>").click()
Is there a way to either grab the top file in the FTP directory as it will be the most current, or to increment the "name" each day?
Upvotes: 3
Views: 103
Reputation: 473843
You can use the by_partial_link_text
approach and avoid checking the date at all. You would get the first matching link element which would also be the top and the "most current" element in your case, from what I understand:
driver.find_element_by_partial_link_text("report.").click()
Upvotes: 3