Reputation: 7195
I am using:
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:
Upvotes: 2
Views: 3646
Reputation: 21
Found same error when running ChromeDriver in multithreading.
Try to add:
ChromeOptions chromeOptions = new ChromeOptions();
.....
chromeOptions.AddArgument("--disable-impl-side-painting"); //it worked for me
.....
var tmp = new ChromeDriver(service, chromeOptions);
Upvotes: 0
Reputation: 7195
I discovered that I had to remove "optimize code" setting from Project->Properties->Build->(Release Configuration)->uncheck "optimize code".
I do not know why the "optimize code" setting would cause this issue.
I cannot claim credit. I followed the instructions at this SO post for the solution. See Josh Berke's post.
Upvotes: 1