John Doe
John Doe

Reputation: 13

selenium webdriver exception (in firefox)

im using selenium firefox driver 3.3.1,selenium java 3.3.0,gecko driver 0.14 and firefox 52.when i run my code "your connection is not secure" page appears but when i manually open it ,it will open without any errors this is the error message i got

Exception in thread "main" org.openqa.selenium.WebDriverException: 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.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604) at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325) at automation.Qwik_events_uat_firefox.main(Qwik_events_uat_firefox.java:24)

Upvotes: 1

Views: 2804

Answers (1)

Madhan
Madhan

Reputation: 5818

As per geckodriver

acceptInsecureCerts
Boolean initially set to false, indicating the session will not implicitly trust untrusted or self-signed TLS certificates on navigation.

You can initialize your FirefoxDriver like below to avoid the issue

    FirefoxProfile ff = new FirefoxProfile();
    ff.setAcceptUntrustedCertificates(true);
    WebDriver driver = new FirefoxDriver(ff);

or you can go with DesiredCapabilities like

    DesiredCapabilities caps = DesiredCapabilities.firefox();
    caps.setCapability("acceptInsecureCerts", true);
    WebDriver driver = new FirefoxDriver(caps);

Also you should use GeckoDriver 0.15 becuase selenium recommends to do so

As per Selenium Changelog

v3.3.1

  • Better support for geckodriver v0.15.0. Notably, exceptions returned from the remote end are now unwrapped properly.

Upvotes: 1

Related Questions