Firefox Error: "Your connection is not secure" while launching driver with Selenium 3.0.1 using Java

11,766

Solution 1

Download Firefox 55 beta and set

capabilities.setCapability("acceptInsecureCerts", true);

Here is my code that works for Firefox 55 beta:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
capabilities.setCapability("acceptInsecureCerts", true);
RemoteWebDriver driver = new RemoteWebDriver(Environment.remoteWebDriverURL, capabilities);

Solution 2

With FF v53+ and Se 3.x (summer 2017), advice from before (May?) 2017 is no longer true.

You have to use Marionette and set capability to True.

Took me few days to sort out all old and obsolete advice, yours for free. :-)

Solution 3

I have tried this approach and it worked well for me.

Create new firefox profile by following below step.

  1. Close all your firefox windows
  2. In the Run dialog box, type in: ‘firefox.exe -p' and then Click OK.
  3. Click “Create Profile”
  4. Create a name for your new profile(say Selenium)
  5. Click “Choose Folder”
  6. Pick location something easy to find — like “C:\NewFirefoxProfile”
  7. Click Finish
  8. Now after selecting newly created profile, start Firefox. Open the specific url you were getting 'Secure Connection Issue', accept SSL certificates for this profile.

enter image description here

Now use the newly created firefox profile to run your selenium test. Modify below code as per your requirement.

System.setProperty("webdriver.firefox.marionette","D:\\SELENUIUM\\Drivers\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();    
FirefoxProfile myprofile = profile.getProfile("C:\\NewFirefoxProfile");//location of your new firefox profile 
WebDriver driver = new FirefoxDriver(myprofile);
driver.get("https://cacert.org/");

Solution 4

Looks like it is not supported yet by geckodriver/Marionette.

You can check below bugs for more information:-

https://github.com/mozilla/geckodriver/issues/93

https://bugzilla.mozilla.org/show_bug.cgi?id=1103196

Share:
11,766
Pratik Patel
Author by

Pratik Patel

An Automation cum Devops engineer working in Computer Industry for more than 5 years and having 4+ years of experience in Automation Testing. I find tremendous interest in learning new computer and programming technologies(Automation especially) and also like to read tech blogs, news and stay updated with the latest trends in the technology world. Have vast knowledge in verticals of Programmatic Advertising & Marketing, Media and Entertainment, Banking & Finance, E-Commerce. When I am not working, I am usually with my Computer playing video games, watching the tech-series, I also love to cook and travel wherever I can! I love to meeting new peoples and learning new things, so please feel free to say hello and share your a with me. TECHNICAL SKILLS: Programming Languages: Java, Python, JavaScript/NodeJS Automation Technologies: Selenium, Appium, Cypress, Espresso, XCUITest, Docker, Jenkins, Gradle, Maven NPM libraries: wd/webdriver.io(Appium), protractor/selenium-webdriver(Selenium), chai, mocha/jasmine(Test framework), sync-request(Synchronous request for API testing), cypress(web-automation testing) Automation Cloud-based platforms: Saucelabs, Kobiton, Browserstack, AWS Device Farm Automation Frameworks/Tools: Se-Lion, Robot, Galen(UI), Redwood HQ, Katalon Studio, Appium Studio, Ranorex Machine learning and Data Scrapping Libraries: BeautifulSoup4, Scrappy, NumPy, SciPy, Scikit-learn, Tensorflow Virtualization/Cloud Technologies: AWS EC2, Google Compute Engine, VMWare ESX Project Management: JIRA, Slack, Trello, AirTable, Confluence, Redmine.

Updated on June 06, 2022

Comments

  • Pratik Patel
    Pratik Patel almost 2 years

    My Firefox version is 46.0.1 and Selenium version is 3.0.1. I am getting error:

    Your connection is not secure

    while executing following code:

        @Test
    public void test() {
        ProfilesIni profile = new ProfilesIni();
        FirefoxProfile ffProfile = profile.getProfile("newCretedProfile");
        ffProfile.setAcceptUntrustedCertificates(true);
        ffProfile.setAssumeUntrustedCertificateIssuer(false);
        System.setProperty("webdriver.gecko.driver", "D:\\SELENUIUM\\Drivers\\geckodriver.exe");
        FirefoxDriver driver = new FirefoxDriver(ffProfile);
        driver.get("http://www.google.com");
        driver.quit();
    }
    

    I have created new firefox profile and followed steps from this url

    Nevertheless it's not working and giving me same error while I launching any site.