Search code examples
pythonfirefoxseleniumphantomjsscraper

Selenium Python Firefox vs PhantomJS


I am writing a webscraper using selenium on python. I wrote the script to pull information from one site, then go to another and pull different information (emails).

When I run the script with browser = webdriver.Firefox(), the script behaves perfectly. However, for speed purposes I decided to switch to browser = webdriver.PhantomJS().

When I do this, (I tested both scenarios), the driver doesnt seem to go change to the second website and instead pull the second round of information (searching for an email) from the first site.

Why would the script behave differently with phantomJS when all other things are exactly the same?


Solution

  • I found the answer. With PhantomJS, you need to specify browser.get('http://www.' + website), which is not required for Firefox.