Selenium on MAC, Message: #39;chromedriver#39; executable may have wrong permissions(MAC 上的 Selenium,消息:“chromedriver可执行文件可能具有错误的权限)
问题描述
我只是想在我的 Mac 上使用 selenium 做一些非常基本的事情,我什至无法打开网页.我收到以下错误:
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.
- 从 ChromeDriver 下载最新的 chromedriver 二进制文件 -WebDriver for Chrome 并将其保存在您的系统中.
- 确保 chromedriver 二进制文件具有所需的权限.
在启动 WebDriver 和 WebClient 时,传递参数 executable_path 以及 chromedriver 的绝对路径 二进制如下:
- 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:
- 'Webdrivers'可执行文件可能有错误的权限.请参阅 https://sites.google.com/a/chromium.org/chromedriver/home
这篇关于MAC 上的 Selenium,消息:“chromedriver"可执行文件可能具有错误的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MAC 上的 Selenium,消息:“chromedriver"可执行文件可能具有错误的权限
基础教程推荐
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 筛选NumPy数组 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01