"Webdrivers"可执行文件可能具有错误的权限.请参阅https://sites.google.com/a/chromium.org/chromedriver/home [英] 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
问题描述
我四处查看了两个文档,但没有找到答案.
I've looked around checked both documentations and have found no answer.
我一直在尝试使用InstaPy一个用于python的instagram api.在因多个错误而失败并假设InstaPy仅存在一些问题之后,我尝试使用硒精对其进行原始编码.插入示例代码并将其更改为我喜欢的方式后,我只是确保此代码可以正常工作.我收到了一个新错误,而不是旧错误,它说权限可能不正确.我尝试重新安装并以admin身份运行,但没有任何效果.我该如何解决和/或这是什么意思
I've been trying to use InstaPy a instagram api for python. After failing with multiple errors and assuming InstaPy is just having some issues so i tried to raw code it using selinium. after inserting the example code and alter it to my liking i just made sure this one would work. I received a new error instead of the old one saying the permissions may not be right. I have tried reinstall and running as admin but nothing works. how do i fix this and/or what does this mean
代码:
import time
from selenium import webdriver
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search path.
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
错误:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Webdrivers\RawBot.py", line 5, in <module>
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search path.
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
推荐答案
此错误消息...
WebDriverException: Message: 'Webdrivers' executable may have wrong permissions.
...表示您尝试使用的 ChromeDriver 变体具有错误的权限.
...implies that the ChromeDriver variant you are trying to use have wrong permissions.
您似乎已经尝试过:
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search system $PATH variable.
几句话:
- 您必须从反斜杠,即
(\\)
. -
所以您的有效代码行将是:
- You have to download chromedriver_win32.zip from the ChromeDriver Download Location and unzip it for usage.
- Additionally, if you are explicitly specifying the Chromedriver binary path you have to append the binary extension as well, effectively i.e. chromedriver.exe.
- While mentioning the Chromedriver binary path you have to either use the single forward slash i.e.
(/)
along with the raw(r)
switch or you have to use the escaped backslash i.e.(\\)
. So your effective line of code will be :
driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')
If your underlying os is linux:
- 您必须从 ChromeDriver下载位置并解压缩以供使用.
- 此外,如果您明确指定 Chromedriver 二进制路径,则不需要必须提供可执行二进制文件的任何扩展名,即 chromedriver .
- 在提及 Chromedriver 二进制路径时,您必须使用单个正斜杠,即
(/)
. -
所以您的有效代码行将是:
- You have to download chromedriver_linux64 from the ChromeDriver Download Location and untar it for usage.
- Additionally, if you are explicitly specifying the Chromedriver binary path you don't have to provide any extension for the executable binary, effectively i.e. chromedriver.
- While mentioning the Chromedriver binary path you have to use the single forward slash i.e.
(/)
. So your effective line of code will be :
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
If your underlying os is macos:
- 您必须从 ChromeDriver下载位置并解压缩以供使用.
- 此外,如果您明确指定 Chromedriver 二进制路径,则不必必须提供可执行二进制文件的任何扩展名,即 chromedriver .
- 在提及
chromedriver
二进制路径时,您必须使用单个正斜杠即(/)
. -
所以您的有效代码行将是:
- You have to download chromedriver_mac64 from the ChromeDriver Download Location and untar it for usage.
- Additionally, if you are explicitly specifying the Chromedriver binary path you don't have to provide any extension for the executable binary, effectively i.e. chromedriver.
- While mentioning the
chromedriver
binary path you have to use the single forward slash i.e.(/)
. So your effective line of code will be :
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
这篇关于"Webdrivers"可执行文件可能具有错误的权限.请参阅https://sites.google.com/a/chromium.org/chromedriver/home的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!