簡體   English   中英

C# OpenQA.Selenium.WebDriverException:“未知錯誤:無法創建 Chrome 進程。”

[英]C# OpenQA.Selenium.WebDriverException: 'unknown error: Failed to create Chrome process.'

信息

朋友們好,幾天前,我遇到了Selenium的問題,這就是標題中的錯誤。 幾天來,我一直在嘗試自己解決這個問題,但一點運氣都沒有。 Chrome 正在從外部文件運行,當我嘗試手動打開時,它可以工作 如果我嘗試從默認位置運行驅動程序,它可以工作 我試過不同版本的 Selenium 沒有運氣和不同版本的 Chrome。

預期成績

ChromeDriver執行 chrome.exe。

實際結果

ChromeDriver 因未知原因無法啟動 chrome.exe。 CLI 圖片

代碼

ChromeDriver driver = new ChromeDriver(new ChromeOptions { BinaryLocation = Path.Combine(Environment.CurrentDirectory, @"GoogleChromePortable") });

異常詳情

OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  Message=unknown error: Failed to create Chrome process.
  Source=WebDriver
  StackTrace:
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at Self_Contained.Program.Main(String[] args) in *:\*\*\SFC\Program.cs:line 11

經過數小時的研究,我發現排除chrome.exe 可能會導致此問題。 我將 chrome.exe 添加到二進制路徑中,瞧,它正在工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM