2

I'm running tests on a Remote Machine through Azure daily scheduled run. Some of the tests are failing with below error log. How can I fix this ?

Note : I do not have method implementation of launching chrome driver as I am referencing dll of other solution which has abstract methods.

Stack : NUnit, C#, Selenium, Visual Studio, Azure, log4Net

OneTimeSetUp: Automation.Test.Framework.Models.Exceptions.AtGenericException : Error initializing WebDriver Chrome ----> System.InvalidOperationException : unknown error: Runtime.evaluate threw exception: DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document. at :1:1 (Session info: chrome=77.0.3865.90) (Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.3.9600 x86_64)

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
JAbdul
  • 59
  • 1
  • 6
  • Can you share the script code which is failing? Does the same tests fail in each run? – Pankaj Devrani Oct 25 '19 at 10:27
  • Found this on chromium: https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document – Ramon Medeiros Oct 25 '19 at 10:34

2 Answers2

1

This error message...

OneTimeSetUp: Automation.Test.Framework.Models.Exceptions.AtGenericException : Error initializing WebDriver Chrome 
System.InvalidOperationException : unknown error: Runtime.evaluate threw exception: DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document. at :1:1 (Session info: chrome=77.0.3865.90) 
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.3.9600 x86_64)

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.36
  • Release Notes of chromedriver=2.36 clearly mentions the following :

Supports Chrome v63-65

Supports Chrome version 77

So there is a clear mismatch between the ChromeDriver v2.36 and the Chrome Browser v77.0


Solution

Ensure that:

  • ChromeDriver is updated to current ChromeDriver v78.0 level.
  • Chrome is updated to current Chrome Version 78.0 level. (as per ChromeDriver v78.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

Guess you should changed the default Chrome capabilities to allow third-party cookies:

Disabling Cookies in Webdriver for Chrome/Firefox

Ramon Medeiros
  • 2,272
  • 2
  • 24
  • 41