Jonas_Hess
Jonas_Hess

Reputation: 2018

Java Selenium error with Firefox-Portable

I am struggling to get our integration tests back up and running after updating our heavily outdated FirefoxPortable to the newest version 68.0.1. I was understood to use the geckodriver. But I keep getting the following message.

Error:

org.openqa.selenium.SessionNotCreatedException(Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_171'
Driver info: driver.version: FirefoxDriver

Code:

    if (OS.isFamilyWindows()) {

        FirefoxBinary binary =
                new FirefoxBinary(new File(binPath + "/firefoxWindows/FirefoxPortable.exe"));
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setCapability("marionette", true);
        System.setProperty("webdriver.gecko.driver", binPath + "/geckoWindows/geckodriver.exe");
        firefoxOptions.setBinary(binary);
        ffDriver = new FirefoxDriver(firefoxOptions);
    }

Our integration tests will be executed on a shared Linux Jenkins test server. For now I am using Windows.

I would like to keep using a portable version of Firefox to prevent conflicts with other teams using the same machine. Also the installation of Docker is unfortunately no option.

We are using Java.version: '1.8.0_171' and we are too late in the release to switch to a later version.

Should I switch to Chrome?

I am in need of a quick solution, thanks.

Upvotes: 0

Views: 1318

Answers (2)

undetected Selenium
undetected Selenium

Reputation: 193088

As you are using FirefoxPortable v68.0.1 presumably you are using the latest release of Selenium v3.141.59 thus using GeckoDriver is mandatory. It is observed that using the following code block GeckoDriver with the help of marionette is able to initiate the FirefoxPortable v68.0.1 browser but soon crashes with an error.

  • Code Block:

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxOptions;
    
    
    public class A_Portable_Firefox {
    
        public static void main(String[] args) {
    
            System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
            FirefoxOptions options = new FirefoxOptions();
            options.setBinary("C:\\FirefoxPortable\\FirefoxPortable.exe");
            WebDriver driver =  new FirefoxDriver(options);
            driver.get("https://stackoverflow.com");
            System.out.println("Page Title is : "+driver.getTitle());
            driver.quit();
        }
    }
    
  • Error Stacktrace:

    Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
    Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
    System info: host: 'DEBANJAN', ip: '192.168.1.125', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.8.0_172'
    Driver info: driver.version: FirefoxDriver
    
  • Browser Snapshot:

FirefoxPortable


Analysis

As per the discussion GeckoDriver v0.23.0 is unable to initiate a new session through FirefoxPortable @andreastt clearly mentioned:

I’m afraid Firefox Portable is not supported by geckodriver.

@whimboo further added:

If the splash screen (or what this is) is blocking Firefox from fully starting up, then Marionette will not be enabled.

Upvotes: 1

Sayali Waghmare
Sayali Waghmare

Reputation: 112

If you are running your tests through jenkins on linux server, i.e jenkins is executing tests on a linux machine,you need to run tests in headless mode of firefox.

Also you need to install xvfb on linux machine.

Upvotes: 0

Related Questions