简体   繁体   中英

ChromeDriver error from an ASP.NET website

I've just updated the chromedriver.exe file on my server (to version 89.0), and I've now this error happening:

[17104] OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: crashed.
[17104]   (unknown error: DevToolsActivePort file doesn't exist)
[17104]   (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 
[17104]    at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) 
[17104]    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) 
[17104]    at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) 
[17104]    at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) 
[17104]    at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout) 

The code is:

 var options = new ChromeOptions();
 options.AddArguments("--headless");
 using (ChromeDriver chromeDriver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), options, TimeSpan.FromSeconds(180)))
 { ..... }
            

This error happens from an ASP.NET website, but not from a.exe app; and this is the same code running. I don't understand what happens (and it worked with the previous chromedriver file)

EDIT

I've downloaded Chrome v87.0 and the matching chromedriver, and it works now using: ChromeDriverService.CreateDefaultService("C:\chrome87-win"). Something is definitely wrong with v89....

I faced the same problem when run chromedriver on my server. After adding the following arguments to chrome options, it works fine. Based on the question: WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); // disabling extensions
options.addArguments("--disable-gpu"); // applicable to windows os only
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--no-sandbox"); // Bypass OS security model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM