0

It is known issue that, Firefox version 47.0.1 is not compatible with Selenium latest version. Even Firefox is announcing to use Marionette instead. Can someone give some details instruction on how to use Marionette with Geb?

As a maven project, I tried all the version of Selenium with Geb but could not be successfull. I tried the following versions;

2.50.0

2.50.1

2.51.0

2.52.0

2.53.0

2.53.1

2.6.0

2.7.0

2.8.0

2.9.0

If this is not the right place to ask this, please guide me.

tenorsax
  • 21,123
  • 9
  • 60
  • 107
Mahbub Rahman
  • 1,295
  • 1
  • 24
  • 44

5 Answers5

2

I have the next configuration in GebConfig.groovy:

firefox {
    System.setProperty("webdriver.gecko.driver","path/geckodriver")
    driver = {new MarionetteDriver()}
}

I am using selenium 3.0.1 and I using the -Dgeb.env=firefox system property in order to make sure it takes my Firefox configuration and it working fine for me

Regards

  • I also use Selenium 3.0.1 from Geb with multiple drivers such as HtmlUnit (incl. JS), PhantomJS, Firefox, IE, Edge, Chrome. It works nicely with all of them. In order to make it less painful to download all the drivers, I recommend [WebDriverManager](https://github.com/bonigarcia/webdrivermanager). – kriegaex Feb 20 '17 at 06:19
1

Download the latest version of selenium standard version 2.53.1 from selenium.hq.org.downloads and try to use the newest version of the Firefox.

Mahbub Rahman
  • 1,295
  • 1
  • 24
  • 44
kumar
  • 66
  • 2
0

With version 48 of Firefox, it looks like the only solution is using marionnette, however I have not been able to get this to work in Geb yet.

This is what I have tried in GebConfig.groovy:

environments {

firefox {
    driver = {
        DesiredCapabilities dc = DesiredCapabilities.firefox();
        LoggingPreferences prefs = new LoggingPreferences();
        prefs.enable(LogType.BROWSER, Level.WARNING);
        dc.setCapability(CapabilityType.LOGGING_PREFS, prefs);
        dc.setCapability("marionette", true);

        String currentDir = System.getProperty("user.dir");
        String marionetteDriverLocation = currentDir + "/WebDriver/wires";
        System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);

        FirefoxProfile p = new FirefoxProfile();
        p.setPreference("webdriver.gecko.driver", marionetteDriverLocation);
        p.setPreference("webdriver.log.file", "/tmp/firefox_console");
        p.setPreference("toolkit.telemetry.enabled", false);
        p.setPreference("geo.enabled", false);
        p.setPreference("plugins.update.notifyUser", false);

        p.setPreference("datareporting.healthreport.service.enabled", false);
        p.setPreference("datareporting.healthreport.uploadEnabled", false);
        p.setPreference("datareporting.policy.dataSubmissionEnabled",false);
        p.setPreference("datareporting.healthreport.service.firstRun", false);
        p.setPreference("datareporting.healthreport.logging.consoleEnabled", false);
        p.setPreference("reader.parse-on-load.enabled", false);

        dc.setCapability(FirefoxDriver.PROFILE, p);

        def driver = new FirefoxDriver(dc)
        driver.manage().timeouts().pageLoadTimeout(45, TimeUnit.SECONDS)
        return driver
    }
Jeff Lowery
  • 2,492
  • 2
  • 32
  • 40
0

It should work with any of the late Selenium versions. (everything > 2.50 not sure for earlier versions)

Marionette is an external driver, it's not included in the Selenium packages (yet?)

You need to Download the gecko driver here https://github.com/mozilla/geckodriver/releases then point selenium to the location of the geckodriver.exe You can do that as Nelson said before in GebConfig with:

import org.openqa.selenium.firefox.MarionetteDriver

driver = {
    System.setProperty("webdriver.gecko.driver","path/geckodriver")
    new MarionetteDriver()
}

to make that work you will need some dependencies in your buildscript, I'm working with gradle, yours might look different, just look into what yours need to look like on maven central

compile('info.novatec.testit:webtester-support-marionette:2.0.4') { transitive = false }
compile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
compile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"

(selenium support might not be necessary for you)

If you need more help, a more specific description of where you are failing would be helpful, you can also look here for a working project (with maven): http://seleniumsimplified.com/2016/04/how-to-use-the-firefox-marionette-driver/

Jay
  • 598
  • 4
  • 7
  • Ran this and got: A problem occurred evaluating root project 'selenium-java-gradle-template'. > Could not get unknown property 'seleniumVersion' for object of type org.gradle.api.internal. artifacts.dsl.dependencies.DefaultDependencyHandler. – Bob Small May 10 '17 at 14:48
  • Better answer: Ran this and got: "A problem occurred evaluating root project 'selenium-java-gradle-template'. > Could not get unknown property 'seleniumVersion' for object of type org.gradle.api.internal. artifacts.dsl.dependencies.DefaultDependencyHandler." So I looked up how to set a variable in gradle and found this: def myVar = "theVar" in our case I just added this to the build.gradle def seleniumVersion = "3.4.0" – Bob Small May 10 '17 at 14:54
  • 1
    Oh, yeah, of course, either declare `seleniumVersion` as a variable. Or replace it in my example with whatever version you're using. So the last `compile` could then look like: `"org.seleniumhq.selenium:selenium-support:3.4.0"` – Jay May 10 '17 at 18:36
0
public class Driver {
public FirefoxDriver getFirefoxDriver(){
    System.setProperty("webdriver.gecko.driver", "./geckodriver.exe");
    System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true");
    System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null");
    FirefoxOptions options = new FirefoxOptions();
    options.setHeadless(true);
    return new FirefoxDriver(options);

}

}

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 22 '22 at 20:36