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

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

2 Comments

i'll try! and actually i don't want my browser to save file, just get it's link! :)
It not work bro! search alot online and maybe Xvfb does't work on windows! :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.