0

I am updating the framework from Selenium 3.0 to 4 and have been encountering a few issues. When I launch my test on Firefox browser, I get the error below.

org.openqa.selenium.WebDriverException: Reached error page: about:neterror?e=nssFailure2&u=https%3A//www.google.com
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.4.1', java.version: '19.0.2'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [1a83efbbba91fc468162d6ee738d7de1c4ba9383, get {url=https://www.google.com}]
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 95.0, moz:accessibilityChecks: false, moz:buildID: 20211129150630, moz:debuggerAddress: localhost:9222, moz:geckodriverVersion: 0.31.0, moz:headless: false, moz:processID: 46398, moz:profile: /var/folders/yj/h3bj394n2tn..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platformName: mac, platformVersion: 21.6.0, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 1a83efbbba91fc468162d6ee738...}

Code

if (browser.toLowerCase().contains("firefox")) {
    FirefoxOptions ffOptions = new FirefoxOptions();
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("webdriver.load.strategy", "unstable");
    profile.setAssumeUntrustedCertificateIssuer(false);
    profile.setPreference("browser.download.dir", "C:\\download");
    profile.setPreference("browser.download.folderList", 2);

    ffOptions.setCapability("browserName", "Firefox");
    ffOptions.setCapability("browserVersion", "95.0");
    HashMap<String, Object> bstackOptions = new HashMap<String, Object>();
    browserstackOptions.put("os", "OS X");
    browserstackOptions.put("osVersion", "Monterey");
    browserstackOptions.put("buildName", "Selenium Java Firefox Profile");
    browserstackOptions.put("sessionName", "Selenium Java Firefox Profile");
    ffOptions.setCapability("bstack:options", browserstackOptions);
    ffOptions.setProfile(profile);
    try {
        browserStackDriver = new RemoteWebDriver(new URL(gds.BROWSERSTACK_URL), ffOptions);
    } catch (Exception e) {
        logger.info("could not connect to remote driver " + testCase + " OS " + os + " Browser " + browser);
        throw (new NullPointerException(e.getMessage()));
    }
}

1 Answer 1

0
package com.profiling;

import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;

public class LaunchFirefoxBrowser {
public static void main(String[] args){
    System.out.println("Inside main in Java");


    FirefoxProfile profile = new FirefoxProfile();
    FirefoxOptions ffOptions = new FirefoxOptions();
    ffOptions.setProfile(profile);

    Map<String, Object> ffOpts = new HashMap<>();
    ffOpts.put("os", "Sonoma");
    ffOpts.put("osVersion", "14.4.1");
    //ffOpts.put("moz:platformVersion", browser.split("_")[1]);

    ffOptions.setCapability("firefoxOption:options", ffOpts);
    WebDriver driver = new FirefoxDriver(ffOptions);
    driver.get("https://www.google.com/");
    driver.quit();
}


}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.