Search code examples
selenium-webdriverpom.xmlselenium-chromedriverheadlessjenkins-cli

In jenkins getting this error org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages


I m trying to run the selenium scripts in jenkins(@localhost) using pom.xml but facing issues w.r.t chrome driver. Chrome Version 52.0 Selenium-server 2.53.0 Below is the complete stacktrace:

================================================================

Tests run: 7, Failures: 1, Errors: 0, Skipped: 6, Time elapsed: 63.654 sec <<< FAILURE! - in TestSuite init(com.arrk.pages.AppleTest) Time elapsed: 63.416 sec <<< FAILURE! org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages

===================================================================== (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.92 seconds Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46' System info: host: 'akshayk', ip: '10.0.2.58', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'

=======================================================================

Driver info: org.openqa.selenium.chrome.ChromeDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at com.arrk.webdriver.WebDriverFactory.getInstance(WebDriverFactory.java:125) at com.arrk.webdriver.WebDriverFactory.getInstance(WebDriverFactory.java:64) at com.arrk.pages.TestBase.init(TestBase.java:145) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104) at org.testng.TestRunner.privateRun(TestRunner.java:774) at org.testng.TestRunner.run(TestRunner.java:624) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1048) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Tried every possible solution regarding this problem. If any more solution there then please let me know.


Solution

  • This looks similar to a bug report on Chrome 51-53: org.openqa.selenium.remote.server.DriverServlet - Exception: unknown error: unable to discover open pages

    That bug links to the main Chrome bug "Fails to navigate to URL when Chrome 51 is launched in session 0 / through CI". Launching a Jenkins slave installed as a Windows service uses session 0.

    The gist is running Chrome from session 0 broke in Chrome 51. The short term workarounds include dropping back to Chrome 50 (if you can find it), or running with the Chrome option "no-sandbox", like so:

    ChromeOptions chromeOptions = new ChromeOptions(); 
    chromeOptions.AddArguments("test-type"); 
    chromeOptions.AddArguments("no-sandbox"); 
    PropertiesCollection.driver = new ChromeDriver(chromeOptions);
    

    A fix is expected in Chrome 54, however the bug response says they aren't planning long-term support for session 0. I am all ears if anyone knows how to launch a Jenkins slave from something other than session 0 on Windows.