![](/img/trans.png)
[英]selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process with ChromeDriver Chrome with Selenium Python
[英]selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process error with ChromeDriver Chrome Selenium
我正在嘗試使用 webdriver 編寫基本的 python-Google Chrome 交互代碼,但是在嘗試在瀏覽器上啟動鏈接時,我經常遇到相同的錯誤。
這是我的代碼:
from selenium import webdriver
import os
class Instagrambot:
def __init__(self, username, password):
self.username = username
self.password = password
self.driver = webdriver.Chrome('./chromedriver.exe')
if __name__ == '__main__':
ig_bot = Instagrambot('temp_username', 'temp_password')
我在當前目錄中有 chromedriver,我正在為我的瀏覽器 (Chrome 79.0.3945.88) 使用正確版本的 chromedriver (79.0.3945.36)。 我得到的完整錯誤是:
Traceback (most recent call last):
File "c:/Users/Arthur/Documents/instabot/bot.py", line 16, in <module>
ig_bot = Instagrambot('temp_username', 'temp_password')
File "c:/Users/Arthur/Documents/instabot/bot.py", line 12, in __init__
self.driver = webdriver.Chrome('./chromedriver.exe')
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__desired_capabilities=desired_capabilities)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__self.start_session(capabilities, browser_profile)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
我已經嘗試過:
將完整的可執行路徑寫入 chromedriver.exe(與 bot.py 相同的文件夾)
按照此答案中的建議覆蓋 Chrome 二進制位置: https : //stackoverflow.com/a/53078276/11206079
如果有人可以幫助我或提供有關如何修復它的任何見解,我將非常高興!
這個錯誤信息...
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
...暗示ChromeDriver無法啟動/生成新的瀏覽上下文,即Chrome 瀏覽器會話。
我在您的代碼塊中沒有看到任何此類問題。 但是,有關您正在使用的二進制文件版本和用戶類型的測試環境的更多詳細信息將有助於我們以更好的方式調試問題。 但是,您很可能以管理員身份執行測試
確保這件事:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.