1

Here is my problem: I'm trying to use selenium to access a webpage and the special about this page is it is an auto redirecting page (you open that page and after few seconds, it automatically redirect to another page). When i use driver = webdriver.Firefox(), my IDM catched that link just perfectly after few seconds.

enter image description here

And because i don't want the browser to come up so i use Phantomjs instead, ut it not working. My application just can get the loading page url (bitdl-1336...) but not the redirected link. Please help!

This is my code:

link = 'http://torrent.ajee.sh/hash.php?hash=' + self.global_hash_code
driver = webdriver.PhantomJS('phantomjs.exe')
driver.get(str(link))
element = driver.find_element_by_link_text('Download Zip')
element.click()
time.sleep(10)
msg = QMessageBox.information(self, QString('Thành công'),QString(driver.current_url))

And this is the result:

enter image description here

Please help!

Sorry about my english

tuankhoa1996
  • 131
  • 4
  • 18

1 Answers1

0

Not exactly an answer to your PhantomJS-specific question, but a workaround to the problem.

And because i don't want the browser to come up so i use Phantomjs instead

You can continue using Firefox, but start it in a Virtual Display, see more information at:

You may also need to let the browser automatically save the archive in a specified directory, see:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195