我环顾四周,查看了这两份文件,却没有找到答案。
我一直试图使用InstaPy,一个用于python的instagram api。在出现多个错误并假设InstaPy只是有一些问题之后,我尝试使用selinium对其进行原始编码。在插入示例代码并根据我的喜好对其进行修改后,我只需确保此代码能够正常工作。我收到了一个新的错误,而不是旧的错误,说权限可能不正确。我已经尝试重新安装和运行作为管理,但没有任何工作。我如何解决这个问题和/或这意味着什么?
代码:
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发布于 2017-11-07 06:00:10
这个错误信息..。
WebDriverException: Message: 'Webdrivers' executable may have wrong permissions.您试图使用的...implies变体具有错误的权限。
你似乎已经尝试过:
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search system $PATH variable.几句话:
webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe') =
- You have to download **chromedriver\_win32.zip** from the [ChromeDriver Download Location](https://chromedriver.storage.googleapis.com/index.html?path=80.0.3987.16/) 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](https://www.computerhope.com/jargon/f/forwards.htm) i.e. `(/)` along with the raw `(r)` switch or you have to use the escaped [backslash](https://pc.net/helpcenter/answers/location_of_backslash_key) i.e. `(\\)`.
- So your effective line of code will be :驱动程序
webdriver.Chrome(executable_path='/path/to/chromedriver') =
- You have to download **chromedriver\_linux64** from the [ChromeDriver Download Location](https://chromedriver.storage.googleapis.com/index.html?path=80.0.3987.16/) 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](https://www.computerhope.com/jargon/f/forwards.htm) i.e. `(/)`.
- So your effective line of code will be :驱动程序
webdriver.Chrome(executable_path='/path/to/chromedriver') =
- You have to download **chromedriver\_mac64** from the [ChromeDriver Download Location](https://chromedriver.storage.googleapis.com/index.html?path=80.0.3987.16/) 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](https://www.computerhope.com/jargon/f/forwards.htm) i.e. `(/)`.
- So your effective line of code will be :驱动程序
发布于 2017-11-13 01:19:10
当您输入完整的文件名,即"chromedriver.exe“时,这个问题就解决了。如果你在窗户上,试试这个。
发布于 2020-03-07 19:42:07
你只需要加上
/chromedriver.exe
在这条路的尽头:
driver = webdriver.Chrome('C:/Users/User/Downloads/chromedriver_win32/chromedriver.exe')
注意:如果您从“文件资源管理器”复制路径,您将得到:
C:\Users\User\Downloads\chromedriver_win32
您需要使用这样的双反斜杠:
C:\Users\User\Downloads\chromedriver_win32
所以你不会有语法错误。或者你可以直接用斜杠。
https://stackoverflow.com/questions/47148872
复制相似问题