Reputation: 23
I am using Selenium in C# to automate against Google Chrome. I am using the latest version of Chrome (78.0.3904.70)
, Selenium.Webdriver (3.141.0)
, and Selenium.Chrome.Webdriver (77.0.0)
.
I use: ChromeDriver chrome = new ChromeDriver();
. Chrome opens, but does not load correctly, like in the image below, and I am unable to use any Selenium features. What do I need to change to use Chromedriver?
I downloaded ChromeDriver v.78
and have referenced it with new ChromeDriver(v78 path)
, and it has the same error.
Upvotes: 2
Views: 2510
Reputation: 193088
This error message...
along with this error message...
...is observed when ChromeDriver / Chrome is unable to load the default extensions.
Historically, the Automation Extension issue with Chrome Browser surfaced a couple of builds earlier then ChromeDriver v2.32 and you can find a detailed discussion in What has changed on Chromedriver 2.32 regarding loading of the automation extension?
Precisely, to address this error you may have to:
disable-extensions
flag--no-sandbox
flag as argument/s when creating your WebDriver session. Special test environments sometimes cause Chrome to crash when the sandbox is enabled. For detaile watch this space as follows:
var option = new ChromeOptions();
option.AddArgument("disable-extensions");
option.AddArgument("--no-sandbox");
driver = new ChromeDriver(option);
Additionally, you need to ensure that (whichever is applicable):
@Test
as non-root / non-administrator user.driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.Upvotes: 2