selenium.common.exceptions.WebDriverException: Message: 'Geckodriver' executable may have wrong permissions using GeckoDriver Firefox Selenium Python

Asif picture Asif · Oct 11, 2017 · Viewed 14k times · Source

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");

Answer

Shoaib Akhtar picture Shoaib Akhtar · Oct 11, 2017

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")