0
votes
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unable to discover open page

Browser is opening but the desired web page is NOT opening & browser is is getting closed within 5secs. After this the exception is showing up in IDE. Attached the screenshot of the the browser This is how the browser looks when it opened

Tried uninstalling (deleted user data also)& reinstalling chrome, but din't work :(

Using JDK 8,

selenium 3.6.0 for Java,

chrome browser-Latest version,

chrome driver-not sure(may be 2.31)

My code

package newPackage;

  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;

  public class MyClass {
        public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "C:\\ChromeDriver_Selenium\\chromedriver.exe"); 

        WebDriver driver=new ChromeDriver(); 
        driver.get("http://google.com"); 
  }
}

OUTPUT I am seeing

Starting ChromeDriver (v2.3) on port 20165
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages
  (Driver info: chromedriver=2.3,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.55 seconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'DESKTOP-9KFNBI3', ip: '192.168.0.104', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: ChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
    at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
    at newPackage.MyClass.main(MyClass.java:10)
5
Update google chrome driver to 2.33 version and check with the same. - Jainish Kapadia

5 Answers

0
votes

Issue might be due to your chrome driver.
Get the chrome driver and set the path in your code and try your code again.Let me know if you are able to overcome this issue.

Use the below link to get latest version of chrome driver(2.33)
From google: https://sites.google.com/a/chromium.org/chromedriver/downloads
[OR]
From Selenium downloads: http://www.seleniumhq.org/download/

0
votes

After some experimentation, I'd agree about ensuring that the chromedriver executable is on your path. You may find that the setting of the system property may be unnecessary.

0
votes

I don't see any such error in your code.

The error you are observing is because of the Versioning mismatch. You are using Selenium v3.6.0 and chromedriver v2.3 (which is pretty old) and are not compatible.

Solution:

As you are working with the latest version of Selenium i.e. v3.6.0, I would suggest you to use either chromedriver v2.32 or the latest chromedriver v2.33

0
votes

you are using very old version of ChromeDriver so that it is not compatible with Selenium jars 3.6.0 and browser , use updated ChromeDriver and these issue is resolved.

This issue occurred when your ChromeDriver doesn't support the Browser. Download Latest ChromeDriver from this Link.

or

You can degrade the Chrome browser which is compitable with ChromeDriver 2.31

0
votes

Update your Chrome Driver to the latest one