WebDriverException: Message: ‘Geckodriver‘ executable may have wrong permissions.

https://stackoverflow.com/questions/46682841/selenium-common-exceptions-webdriverexception-message-geckodriver-executable

 

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

pythonseleniumselenium-webdriverfirefoxgeckodriver



Share

Improve this question

Follow

edited Dec 14 '19 at 11:19

 

DebanjanB

111k2727 gold badges152152 silver badges201201 bronze badges

asked Oct 11 '17 at 7:58

 

Asif

5111 gold badge11 silver badge22 bronze badges

  • 2

    If you're on a linux system, use which geckodriver to find the path where the geckodriver executable is. Then use ll /path/to/geckodriver to show the permissions. You should have execution rights. If you don't, use chmod +x /path/to/geckodriver to give execution rights to all users. – con-- Oct 11 '17 at 8:17

  • @con-- he is using windows, so I don't think suggested thing would work – Gaurang Shah Oct 11 '17 at 8:30

  • can you try to put into some other driver other than c – Gaurang Shah Oct 11 '17 at 8:31

  • @GaurangShah yes, I have tried keeping my Geckodriver in D drive. but still getting the same error. – Asif Oct 11 '17 at 9:02 

  • showing binary is not firefox executable – DikShU Sep 23 '20 at 5:00

add a comment

4 Answers

ActiveOldestVotes

5

 

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



Share

Improve this answer

Follow

answered Oct 11 '17 at 9:15

 

Shoaib Akhtar

1,23733 gold badges1515 silver badges3939 bronze badges

  • Thanks! but it leads me to the different kinda error selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities – Asif Oct 11 '17 at 10:04 

  • Check once whether this sample program run on your pc? from selenium import webdriver driver = webdriver.Firefox(executable_path='D:/Software/BrowsersDriver/GeckoDriver/geckodriver.exe')//set your path accordingl,y driver.get('google.com' – Shoaib Akhtar Oct 11 '17 at 10:15 

add a comment

4

 

make your geckodriver executable:

sudo chmod +x geckodriver



Share

Improve this answer

Follow

answered Nov 11 '18 at 1:03

 

Shawn

39533 silver badges55 bronze badges

add a comment

1

 

While working with Selenium v3.6.0geckodriver 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()



Share

Improve this answer

Follow

edited Dec 14 '19 at 11:23

answered Oct 11 '17 at 15:52

 

DebanjanB

111k2727 gold badges152152 silver badges201201 bronze badges

add a comment

0

 

First as per @shohib your are path is wrong, it is correct

driver = webdriver.Firefox(firefox_binary=binary,
                               executable_path="C:\\Users\\mohammed.asif\\Geckodriver\\geckodriver.exe")

For this error

error selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

You need to make correct combination of Firefox and Selenium Jars

Either update the firefox and selenium jars, I would suggest to use

Firefox 50-52 and Selenium 3.4.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值