I am using:
- chromedriver=2.26.436362
- Chrome Version 55.0.2883.87 m (64-bit)
- .Net C# 4.6.1 / Visual Studio 2015 Community Edition
I am seeing the following exception during website testing (this is my log4net entry):
FATAL2017-01-09 05:03:10 – no such session
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 6.1.7601 SP1 x86_64)
FATAL2017-01-09 05:03:10 – at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScript(String script, Object[] args)
I start my driver session like this:
var options = new ChromeOptions();
options.AddArguments("test-type");
options.AddArgument("incognito"); // works
options.AddArgument("--disable-bundled-ppapi-flash"); // works! this turns off shockwave
options.AddArgument("--disable-extensions"); // works
options.AddArguments("--start-fullscreen");
var driver = new ChromeDriver(options);
driver.Manage().Cookies.DeleteAllCookies();
return driver;
And I navigate to a "new" tab in Chrome with the following command:
lock (Session.Driver)
{
JavaScriptExecutor jscript = Session.Driver as IJavaScriptExecutor;
jscript.ExecuteScript(string.Format("window.open('{0}', '_blank');", url));
}
Which works in DEBUG
100% of the time. In RELEASE
mode, I receive the error above. Which makes this a difficult problem to resolve...no debugger.
I have checked and the session is active, and at the point of entry two handles in Driver.WindowHandles
corresponding to the tabs in Chrome are available. I have resorted to Console.Writeline()
statements to view variables that I would normally diagnose in the watch window in visual studio debug mode.
I have been unable to reproduce this exception while debugging. It always "works" during debugging.
There are 5-10 other SO posts about the same issue. The answers to those questions involved updating the chromedriver.exe (I have the latest, and also tried older versions), or, are working with a different technology stack. There must be something else going on here.
Notes:
- I can reproduce this error every time in RELEASE mode. However in DEBUG mode it works every time (no error).
- I tried downgrading to chrome32_53.0.2785.116 (I uninstalled version 54) - same results no improvement.
- I checked which chrome driver I'm using for DEBUG: it is exactly the same chromedriver.exe used during RELEASE. (this leads me to conclude that neither Chrome, nor the Chrome driver, are the culprit).