首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向chromedriver.exe授予权限?

如何向chromedriver.exe授予权限?
EN

Stack Overflow用户
提问于 2021-04-12 23:27:14
回答 1查看 74关注 0票数 0

我在人脸识别项目中使用了chrome驱动程序,但在下面的第4行出现了错误。如何向chromedriver.exe授予权限?

代码:

代码语言:javascript
复制
data_path = '/content/drive/MyDrive/FaceRecognition/faces' 
onlyfiles = [f for f in listdir(data_path) if isfile(join(data_path,f))]
url='https://www.naver.com/' 
browser = webdriver.Chrome(r'/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe')

======================================================================================================错误消息:

代码语言:javascript
复制
PermissionError                           Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     75                                             stderr=self.log_file,
---> 76                                             stdin=PIPE)
     77         except TypeError:

4 frames
PermissionError: [Errno 13] Permission denied: '/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe'

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     86                 raise WebDriverException(
     87                     "'%s' executable may have wrong permissions. %s" % (
---> 88                         os.path.basename(self.path), self.start_error_message)
     89                 )
     90             else:

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

回答 1

Stack Overflow用户

发布于 2021-04-12 23:37:12

此错误消息...

代码语言:javascript
复制
PermissionError: [Errno 13] Permission denied: '/content/'
.
WebDriverException: Message: '' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

解决方案

在传递密钥executable_path时,您需要传递WebDriver变量名称的绝对路径,即chromedriver,如下所示:

代码语言:javascript
复制
driver = webdriver.Chrome(executable_path='/content/chromedriver')
                          webdriver variant name ^^^chromedriver^^^ needs to be appended

参考文献

您可以在以下位置找到几个相关的讨论:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67061159

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档