0
我試圖用python Selenium打開Internet Explorer,但不斷收到錯誤「PermissionError:[WinError 5] Access denied」。python Selenium PermissionError:[WinError 5]訪問被拒絕
我已經下載了Internet Explorer驅動程序服務器以管理員身份運行腳本還有什麼我可以做的嗎?
代碼
from selenium import webdriver
driver = webdriver.Ie(r"C:\\Users\\N\\Downloads\\IEwebdriver\\IEDriverServer_x64_2.53.1")
driver.get("http://www.hotmail.com")
driver.maximize_window()
driver.implicitly_wait(20)
完整的錯誤消息
C:\Users\N\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/N/PycharmProjects/first/SeleniumScripts/Myfirstscripts.py
Traceback (most recent call last):
File "C:\Users\N\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\N\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\N\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
在處理上述異常,另一個異常:
Traceback (most recent call last):
File "C:/Users/N/PycharmProjects/first/SeleniumScripts/Myfirstscripts.py", line 5, in <module>
driver = webdriver.Ie(r"C:\\Users\\N\\Downloads\\IEwebdriver\\IEDriverServer_x64_2.53.1")
File "C:\Users\N\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 49, in __init__
self.iedriver.start()
File "C:\Users\N\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: 'IEDriverServer_x64_2.53.1' executable may have wrong permissions. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.service.Service object at 0x01C9D410>>
Traceback (most recent call last):
File "C:\Users\N\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Users\N\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'
Process finished with exit code 1
我使用的Microsoft Windows 10 。
好,誤差說「IEDriverServer_x64_2.53.1' 可執行文件可能有錯誤的權限,請從http://selenium-release.storage.googleapis.com/index.html下載和HTTPS讀了起來:// github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver」。是你做的嗎? – n1c9
你的操作系統是什麼? –