错误消息:
'chromedriver' executable needs to be in PATH
我试图在pycharm中使用selenium编写脚本,但是发生了上述错误。I have already linked my selenium to pycharm as seen here (fresh and up to date)。
我是新来的硒,不是铬河在文件夹“硒” 如果不是,我在哪里可以找到它并添加到路径中?
顺便说一下,我试着在cmd中键入“chromedriver”,但是,它并没有被识别为内部或外部命令。
错误如下所示:
Traceback (most recent call last):
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
PermissionError: [WinError 5] Permission denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/sebastian/PycharmProjects/web/bot.py", line 10, in <module>
browser = webdriver.Chrome("C:/Users/sebastian/desktop/selenium-3.0.1")
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'selenium-3.0.1' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x01EDEAF0>>
Traceback (most recent call last):
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
试试这个:
您可以在此处下载ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/downloads
那么您有多个options:
path
直接通过
executable_path
指定位置另一种方法是下载并解压chromedriver,并将'chromedriver.exe'放在C:\ Python27\Scripts中,然后不需要提供驱动程序的路径,只需
会有用的
相关问题 更多 >
编程相关推荐