selenium.common.exceptions.WebDriverException: Message: 'Geckodriver' executable may have wrong permissions using GeckoDriver Firefox Selenium Python
Solution 1
Path for driver is not set correctly, you need to set path till the .exe as shown below
driver = webdriver.Firefox(firefox_binary=binary,
executable_path="C:\\Users\\mohammed.asif\\Geckodriver\\geckodriver.exe")
Solution 2
make your geckodriver executable:
sudo chmod +x geckodriver
Solution 3
While working with Selenium v3.6.0, geckodriver and Mozilla Firefox through Selenium-Python clients, you need to download the geckodriver.exe from the repository and place it anywhere with in your system and provide the reference of the geckodriver.exe through its absolute path while initializing the webdriver. Additionally if you are having multiple instances of Mozilla Firefox installed on your system, you can mention the absolute path of the intended firefox binary i.e. firefox.exe
through Options()
as follows:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
if __name__ == '__main__':
binary = r'C:\Program Files\Mozilla Firefox\firefox.exe'
options = Options()
options.binary = binary
browser = webdriver.Firefox(firefox_options=options, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
browser.get('http://google.com/')
browser.quit()
Admin
Updated on June 14, 2022Comments
-
Admin almost 2 years
I get this error when I try to execute my first Selenium/python code.
selenium.common.exceptions.WebDriverException: Message: 'Geckodriver' executable may have wrong permissions.
My code :
from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary if __name__ == '__main__': binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\firefox.exe') driver = webdriver.Firefox(firefox_binary=binary, executable_path="C:\\Users\\mohammed.asif\\Geckodriver") driver=webdriver.Firefox() driver.get("www.google.com");