本文介紹了selenium.common.exceptions.WebDriverException:消息:“庫"可執行文件可能對 ChromeDriver 有錯誤的權限的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想使用 chrome 網絡驅動程序連接到https://www.google.com".下面是代碼.
I want to use the chrome webdriver to connect to "https://www.google.com". below is the code.
from selenium import webdriver
import time
driver = webdriver.Chrome("C:\Users\faisal\library")
driver.set_page_load_timeout(10)
driver.get("https://www.google.com")
driver.find_element_by_name("q").send_keys(" automation by name ")
driver.find_element_by_name("blink").click()
time.sleep(5)
driver.close()
當我運行測試時,顯示以下錯誤消息.這是一個權限問題
When I run the test, the following error message is displayed.Its a permission problem
C:UsersfaisalPycharmProjectsfirstSeleniumTest2venvScriptspython.exe C:/Users/faisal/PycharmProjects/firstSeleniumTest2/test.py
Traceback (most recent call last):
File "C:UsersfaisalPycharmProjectsfirstSeleniumTest2venvlibsite-packagesseleniumwebdrivercommonservice.py", line 76, in start
stdin=PIPE)
File "C:Pythonlibsubprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:Pythonlibsubprocess.py", line 997, 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:/Users/faisal/PycharmProjects/firstSeleniumTest2/test.py", line 4, in <module>
driver = webdriver.Chrome("C:\Users\faisal\library")
File "C:UsersfaisalPycharmProjectsfirstSeleniumTest2venvlibsite-packagesseleniumwebdriverchromewebdriver.py", line 68, in __init__
self.service.start()
File "C:UsersfaisalPycharmProjectsfirstSeleniumTest2venvlibsite-packagesseleniumwebdrivercommonservice.py", line 88, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'library' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
推薦答案
C:Usersfaisallibrary
不是 chromedriver 的正確路徑.提供 chromedriver 文件的實際路徑.
C:Usersfaisallibrary
is not the correct path to chromedriver. Give the actual path to your chromedriver file.
這篇關于selenium.common.exceptions.WebDriverException:消息:“庫"可執行文件可能對 ChromeDriver 有錯誤的權限的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!