MAC上的硒,消息:"chromedriver"可执行文件可能具有错误的权限 [英] Selenium on MAC, Message: 'chromedriver' executable may have wrong permissions

查看:332
本文介绍了MAC上的硒,消息:"chromedriver"可执行文件可能具有错误的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想使用硒在Mac上做一些非常基础的事情,甚至无法打开网页.我遇到了一个错误:

I'm just trying to do something very basic on my Mac using selenium and I can't even open a webpage. I'm getting an error of :

Traceback (most recent call last):
  File "/Users/godsinred/Desktop/InstagramLiker/GmailAccountGenerator.py", line 10, in <module>
    driver = webdriver.Chrome()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/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: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

这是我的下面的代码:

from selenium import webdriver
import time

link = "https://accounts.google.com"
driver = webdriver.Chrome()
driver.get(link)
time.sleep(5)

driver.quit()

推荐答案

错误说明了一切:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

该错误清楚地提到正在检测到的 chromedriver 具有错误的权限.

The error clearly mentions that the chromedriver which is getting detected have wrong permissions.

  • Download the latest chromedriver binary from ChromeDriver - WebDriver for Chrome and save it in your system.
  • Ensure that chromedriver binary have the required permissions.
  • While initiating the WebDriver and WebClient pass the argument executable_path along with the absolute path of the chromedriver binary as follows :

from selenium import webdriver

link = "https://accounts.google.com"
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver.get(link)

您可以在以下位置找到详细的相关讨论

You can find a detailed relevant discussion in:

这篇关于MAC上的硒,消息:"chromedriver"可执行文件可能具有错误的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆