問題描述
我查看了這兩個文檔,但沒有找到答案.
I've looked around checked both documentations and have found no answer.
我一直在嘗試使用 InstaPy 一個 instagram api for python.在出現多個錯誤并假設 InstaPy 只是遇到一些問題后,我嘗試使用 selinium 對其進行原始編碼.在插入示例代碼并將其更改為我喜歡的之后,我只是確保這個可以工作.我收到一個新錯誤而不是舊錯誤,說權限可能不正確.我嘗試重新安裝并以管理員身份運行,但沒有任何效果.我該如何解決這個問題和/或這是什么意思
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-32libsite-packagesseleniumwebdrivercommonservice.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:Program Files (x86)Python36-32libsubprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:Program Files (x86)Python36-32libsubprocess.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:WebdriversRawBot.py", line 5, in <module>
driver = webdriver.Chrome('C:Webdrivers') # Optional argument, if not specified will search path.
File "C:Program Files (x86)Python36-32libsite-packagesseleniumwebdriverchromewebdriver.py", line 62, in __init__
self.service.start()
File "C:Program Files (x86)Python36-32libsite-packagesseleniumwebdrivercommonservice.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.
幾句話:
如果您的底層 os 是windows:
- 您必須從 chromedriver_win32.zipnoreferrer">ChromeDriver 下載位置并解壓后使用.
- 此外,如果您明確指定 Chromedriver 二進制路徑,則還必須附加二進制擴展名,即 chromedriver.exe.
- 在提到 Chromedriver 二進制路徑時,您必須使用單個 正斜杠 即
(/)
以及原始(r)
開關,或者您必須使用轉義的 反斜杠 即(\)
. 所以你的有效代碼行將是:
- 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')
如果您的底層 os 是linux:
- 您必須從 chromedriver_linux64>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')
如果您的底層 os 是macos:
- 您必須從 chromedriver_mac64>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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!