3

I am trying to get Selenium to run with Firefox and can't get the most basic script to run. My script is:

from selenium import webdriver

# create a new Firefox session
driver = webdriver.Firefox()
driver.maximize_window()

# navigate to the application home page
driver.get("http://www.google.com/")

When that runs the browser opens but the URL is never loaded and I get the error:

raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.

I have done a lot of searching for answers on this, and they all seem to revolve around version issues that are resolved for older versions of Firefox/Selenium. Generally updating Selenium with pip install -U selenium is the solution. But this is a new machine that I just set up and everything is up-to-date already.

  • Firefox (43.0.4)
  • Selenium (2.48.0)

Pip tells me Selenium is already up-to-date. So I am wondering what other problems might cause this and what solutions I can try.

Pachilds
  • 143
  • 1
  • 2
  • 9
  • Just checked locally (on Mac) - selenium 2.48 and Firefox 43 (and checked 44 also) - runs normally without errors. Can you recheck that this is really the 2.48 selenium installed? Thanks. – alecxe Jan 11 '16 at 15:45
  • H:\>pip freeze shows selenium==2.48.0. I have double checked this multiple times this morning in trying to figure this out. I have also uninstalled and reinstalled Selenium in the hopes that this would fix it. Pip won't upgrade the version I have since it says the "Requirement already up-to-date" – Pachilds Jan 11 '16 at 17:52
  • Please try to downgrade firefox to one of the older versions: https://ftp.mozilla.org/pub/firefox/releases/. – alecxe Jan 11 '16 at 18:21
  • Tried downgrading to Firefox 42 and saw error again. I then went to the desktop that this machine is replacing and checked it's settings. It is using the same Python (3.5.1), same Eclipse (4.5.1), same PyDev (4.4.0), and the same Firefox and Selenium mentioned originally above. On that system this script works and Firefox opens fine. Any ideas about what a brand new machine might be missing that could cause this issue? A setting perhaps in any of these applications? – Pachilds Jan 11 '16 at 20:31
  • I have done more research and dug around in the firefox_binary code and found that my problem is the same as described in: http://stackoverflow.com/a/27574843/4399814. Basically, webdriver is polling to makes it's connection and after 30 seconds it times out. It isn't a version incompatibility per se, since I have another machine with these version running that works fine. But on this machine some unknown circumstance causes this to fail every time. – Pachilds Jan 12 '16 at 20:47
  • I have the same issue. I would only add that the first time I ran it, a pop-up window said something about the firewall... – Pedro Braz Oct 03 '16 at 17:51
  • Same issue. Two computers, same versions of python and selenium. Works on one but not the other. – user2276896 Oct 03 '16 at 22:15
  • Update: downgraded to FF 45 on the non-working machine, and now it's fine. – user2276896 Oct 03 '16 at 22:25

0 Answers0