Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

python - selenium.common.exceptions.WebDriverException: Message: 'library' executable may have wrong permissions for ChromeDriver

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

C:Usersfaisallibrary is not the correct path to chromedriver. Give the actual path to your chromedriver file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...