0

I am using below to download a .txt file from a webpage.

The webpage has a button and when you click on it, it starts a download of .txt file straight (not giving choice for destination folder selection). For example if using Chrome, the downloaded file goes into the default folder on local drive.

Using Python and Selenium it simply is:

driver = webdriver.PhantomJS()
url = www.the_url_link.com
driver.get(url)
driver.find_element_by_xpath("the_xpath_here").submit()
driver.implicitly_wait(5)
driver.close()

it runs smoothly and returned no error so I assume it's successful. the problem is that I can’t find the downloaded file.

where are they? And if there are more than one, can I rename them?

Many thanks.

Mark K
  • 8,767
  • 14
  • 58
  • 118
  • I think this is relevant: http://stackoverflow.com/questions/25755713/using-selenium-with-python-and-phantomjs-to-download-file-to-filesystem. And this: http://stackoverflow.com/questions/27911395/download-file-via-hyperlink-in-phantomjs-using-selenium – alecxe Jul 21 '15 at 04:13
  • @alecxe, yes, sir alecxe. I just find it and reading it. please advise if I shall delete this post. – Mark K Jul 21 '15 at 04:14
  • Well, Community helped here :) By the way, looks like the problem can be solved with PhantomJS 2 - I should probably revise the answers in the linked threads. Thanks! – alecxe Jul 21 '15 at 04:19
  • @alecxe, sir, yes please. I can't figure it out with PhantomJS 2 neither... – Mark K Jul 21 '15 at 04:48

0 Answers0