Reputation: 1
I've had some trouble trying to get selenium to do stuff with browsers. I'm a super-beginner at this type of stuff, but I still searched, and the most pertinent response I found was that I needed to run the Application as administrator, but it didn't change anything. Here's my code and the error message. Thanks alot.
import time
from selenium import webdriver
driver = webdriver.Firefox(executable_path="C:\Program Files\Mozilla Firefox")
My error message :
Traceback (most recent call last):
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Axel\Desktop\PYTHON\code.py", line 3, in <module>
driver = webdriver.Firefox(executable_path="C:\Program Files\Mozilla Firefox")
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 160, in __init__
self.service.start()
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 88, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'Mozilla Firefox' executable may have wrong permissions.
I'm pretty sure these two errors are just one, and I've gone through a whole bunch of threads, but i never properly understand things. I wondered if it had something to do with geckdriver (which i havem't and don't know how to install.) Thanks alot!
Upvotes: 0
Views: 1559
Reputation: 193088
This error message...
selenium.common.exceptions.WebDriverException: Message: 'Mozilla Firefox' executable may have wrong permissions.
...implies that the Mozilla Firefox executable was unaccessable due to wrong permissions.
While working with Selenium v3.x, GeckoDriver and Firefox you have to consider certain facts as follows:
firefox.exe
) you need to pass the absolute path of the GeckoDriver binary through the argument executable_path
within single quotes (i.e. ''
) along with the raw (r
) switch.Your effective code block will be as follows:
from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
Upvotes: 1
Reputation: 1
I believe that for Firefox version (47.0 +) you need to use geckodriver. Check it out here: https://github.com/mozilla/geckodriver/releases
Upvotes: 0