Lets us see how to launch firefox browser using Selenium WebDriver.....


Launching Firefox Browser using Selenium WebDriver:

  • Selenium WebDriver do not require any additional utility to be set before launching the Firefox browser.
  • User need not to set any other property because selenium package automatically references towards the default location of the firefox.exe or firefox.dmg.

Complete code for Firefox :

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FirefoxBrowserTest {

public static void main(String[] args) {

WebDriver driver = null;

// Launch the firefox browser
driver = new FirefoxDriver();

// access gmail.com url in firefox
driver.get("http://www.gmail.com");

//Maximizing the Firefox browser window
driver.manage().window().maximize();

}

}
Note: The above code will support upto Firefox Browser Version 47.0.1 and Selenium-Standalone-Server-2.53.1.jar
Categories: