Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Webdriver error: "Can't load the profile"

I'm using Selenium Webdriver (Python bindings) and my script works on Mac (OS X 10.6.8), but not on PC (Windows 7 Enterprise). Here's the error I get:

C:\Python27>python myscript.py
Traceback (most recent call last):
  File "myscript.py", line 303, in <module>
    myfunction(arg1)
  File "myscript.py", line 87, in myfunction
    browser = webdriver.Firefox(firefox_profile = fp)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 61, in __init__
    self.binary, timeout),
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 61, in launch_browser
    self._wait_until_connectable()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 105, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: "Can't load the profile.
 Profile Dir: c:\\users\\marzagao.1\\appdata\\local\\temp\\tmpnn0nhk Firefox out
put: "

Here's the relevant part of my script (I'm iterating over different download folders):

for download_folder in list_of_download_folders:

    fp = webdriver.FirefoxProfile()
    fp.set_preference("browser.download.folderList", 2)
    fp.set_preference("browser.download.manager.showWhenStarting", False)
    fp.set_preference("browser.download.dir", download_folder)
    fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/plain")
    browser = webdriver.Firefox(firefox_profile = fp)

    # gets URL, download files

I googled around and apparently this error message may have different causes. I tried this solution here but it didn't work (I guess it's not applicable to my case, even though the error message is similar). Any thoughts?

(Windows 7 Enterprise, Service Pack 1, Python 2.7.5, Selenium 2.34, Firefox 23.0)

like image 971
Parzival Avatar asked Oct 21 '22 03:10

Parzival


1 Answers

It seems like Firefox 23 is not yet supported. Selenium 2.34 added support for Firefox 22, now there is 2.35 released, but there is nothing mentioned about FF23.

So i suggest you downgrade your firefox to v22 or try the new 2.35 selenium library.

https://github.com/SeleniumHQ/selenium/blob/master/py/CHANGES

How it works on mac? - i don't know, are you sure you are running ff23 there?

like image 122
Erki M. Avatar answered Oct 24 '22 02:10

Erki M.