Steven
Steven

Reputation: 15258

Error windows with specified version of firefox and selenium

I am using python and selenium. On my pc, i have two version of firefox

the first one in ProgrammFiles is version 21 The latest one is in "C:\Users\User\AppData\Local\Mozilla Firefox"

I would like to run selenium on the lastest one, but i got an error message:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary("C:\Users\User\AppData\Local\Mozilla Firefox")
browser = webdriver.Firefox(firefox_binary=binary)

Traceback (most recent call last):

File "", line 1, in browser = webdriver.Firefox(firefox_binary=binary)

File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 77, in init self.binary, timeout),

File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\extension_connection.py", line 49, in init self.binary.launch_browser(self.profile)

File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\firefox_binary.py", line 67, in launch_browser self._start_from_profile_path(self.profile.path)

File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\firefox_binary.py", line 90, in _start_from_profile_path env=self._firefox_env)

File "C:\Python27\lib\subprocess.py", line 710, in init errread, errwrite)

File "C:\Python27\lib\subprocess.py", line 958, in _execute_child startupinfo)

WindowsError: [Error 5] アクセスが拒否されました。

Do you have any hint to give me to solve this problem ?

Upvotes: 0

Views: 552

Answers (1)

Mukesh Takhtani
Mukesh Takhtani

Reputation: 862

The firefox binary path that needs to be passed in FirefoxBinary('') should be the path for the executable 'firefox.exe'.

E.g.:

ff_binary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
driver = webdriver.Firefox(firefox_binary=ff_binary)

PS: In your case, the path you've specified is the path where the firefox profile is stored normally.

Hope this helps.

Upvotes: 1

Related Questions