8

I am using webdriver V 3.0.1 and firefox V 46. I am facing an error as "Your connection is not secure".

enter image description here

Please help me to overcome from this issue. Below you can find my code

    System.setProperty("webdriver.gecko.driver","D:\\Software\\Webdriver\\gecko new\\geckodriver-v0.11.1-win64\\geckodriver.exe");
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("network.proxy.type", 0);
    profile.setAcceptUntrustedCertificates(true); 
    profile.setAssumeUntrustedCertificateIssuer(false);
    WebDriver driver = new FirefoxDriver(profile);
    driver.get("http://qa.applications.marykayintouch.com/Login/Login.aspx");
Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
Ashok
  • 115
  • 3
  • 8
  • in browser your URL is displaying with `https` and in your code `http` . Why it is so ? – NarendraR Dec 23 '16 at 06:51
  • By default it is changed to https. application is launching successfully and goes back to not secure page. – Ashok Dec 23 '16 at 07:02
  • I tried all the solutions which are suggested on this page but bad luck. I am using Webdriver 3.0.1 and firefox browser V 50.1.0. I can able to navigate to common sites like google, facebook, Gmail. But the below-mentioned URL is not navigating "https://qa.applications.marykayintouch.com/Login/Login.aspx". Manually it is working fine. Kindly help me – Ashok Dec 26 '16 at 13:44
  • @Ashok Did you find a solution for this? – tholu Jun 19 '17 at 15:11

3 Answers3

1

To me, the most simple and efficient solution was to do this

var options = new FirefoxOptions()
{
    AcceptInsecureCertificates = true
};

using (var driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options))
{
    // Your code
}

I tried using Sanjay Bhimani's example but it didn't work so looked into the available constructors and ended up with the above code.

Mathieu VIALES
  • 4,526
  • 3
  • 31
  • 48
0

It seems SSLCertificates error Just try with editing capabilities

ProfilesIni profiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","custom firefox profile name");
String browser_profile = System.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = profiles.getProfile(browser_profile); 
profile.setAcceptUntrustedCertificates (true); 
webdriver = new FirefoxDriver(profile); 

or

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new FirefoxDriver(capabilities);

or

DesiredCapabilities capabilities = new DesiredCapabilities();
ProfilesIni profiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","custom firefox profile name");
String browser_profile = System.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = profiles.getProfile(browser_profile); 
profile.setAcceptUntrustedCertificates(true); 
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
webdriver = new FirefoxDriver(capabilities); 

Hope it works.

Sanjay Bhimani
  • 1,593
  • 1
  • 15
  • 29
  • I tried all the solutions which are suggested on this page but bad luck. I am using Webdriver 3.0.1 and firefox browser V 50.1.0. I can able to navigate to common sites like google, facebook, Gmail. But the below-mentioned URL is not navigating "https://qa.applications.marykayintouch.com/Login/Login.aspx". Manually it is working fine. Kindly help me – Ashok Dec 26 '16 at 13:43
  • I tried all the solutions which are suggested on this page but bad luck. I am using Webdriver 3.0.1 and firefox browser V 50.1.0. I can able to navigate to common sites like google, facebook, Gmail. But the below-mentioned URL is not navigating "https://qa.applications.marykayintouch.com/Login/Login.aspx". Manually it is working fine. Kindly help me – Ashok Dec 26 '16 at 13:44
0

For handling SSL certificate error in Firefox, we need to use desired capabilities of Selenium Webdriver and follow the following steps:

ProfilesIni allProfiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","your custom firefox profile name");
String browserProfile = stem.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = allProfiles.getProfile(browserProfile); 
profile.setAcceptUntrustedCertificates (true); 
webdriver = new FirefoxDriver(profile); 

You can refer the following for reference: Handling UntrustedSSLcertificates using WebDriver

Community
  • 1
  • 1
Mahima
  • 26
  • 4
  • I tried all the solutions which are suggested on this page but bad luck. I am using Webdriver 3.0.1 and firefox browser V 50.1.0. I can able to navigate to common sites like google, facebook, Gmail. But the below-mentioned URL is not navigating "https://qa.applications.marykayintouch.com/Login/Login.aspx". Manually it is working fine. Kindly help me – Ashok Dec 26 '16 at 13:43