Search
  • 9to5 Technologies

How to Launch firefox browser using Geckodriver in Selenium 3.0?



Gecko Driver is the link between your tests in Selenium and the Firefox browser. Gecko Driver is a proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers i.e. Mozilla Firefox in this case. As Selenium 3 will not have any native implementation of FF, we have to direct all the driver commands through Gecko Driver. Gecko Driver is an executable file that you need to have in one of the system path before starting your tests. Gecko is the name of the layout engine developed by the Mozilla Project. Gecko’s function is to read web content, such as HTML, CSS, XUL, JavaScript, and render it on the user’s screen or print it.

It starts a server on your system. All your tests communicate to this server to run the tests. It acts as a proxy between the local and remote ends and translates calls into the Marionette automation protocol. To use Marionette or Firefox with Selenium 3 all you need is:

  1. Install geckodriver.exe on your system.

  2. Add path of geckodriver.exe in your code.

  3. Use Firefox in your code.

The other important changes in Selenium 3.x are listed below:

  • Minimum java version is now 8+

  • The original RC APIs are only available via the leg-rc package.

  • To run exported IDE tests, ensure that the leg-rc package is on the classpath.

  • Support for Firefox is via Mozilla’s geckodriver.

  • Support for Edge is provided by MS

  • Official support for IE requires version 9 or above

  • New html-table runner backed by WebDriver.

  • Unused command line arguments are now no longer parsed.

CODE:

public class FirstTest {

public static void main(String[] args) {

System.setProperty(“webdriver.gecko.driver”, ”/home/sid / Downloads / geckodriver”);

DesiredCapabilities capabilities = DesiredCapabilities.firefox();

WebDriver driver = new FirefoxDriver(capabilities);

String url = “http://www.xyz.com/”";

driver.get(url);

System.out.println(“Successfully opened the website http://www.xyz.com”");

}

}

9 views

Contact Us

 Address.212, 2nd Floor, Grand Mall, Jalandhar, Punjab 144001, India

Tel. +91-7710795555

      +91-7710793555

QUICK LINKS

© 2019 by NTF. Proudly created with 9to5Technologies  privacy policy