In this article, we will discuss about the Mozilla Firefox Web Driver. Firefox is the most traditional browser, Selenium WebDriver doesn't require any additional utility to be set before launching the browser.The Selenium package automatically detect default location of the firefox.exe, User need not to set any other property. FirefoxDriver comes as a part of Selenium package and is present in xpi format.
Following source code is use to run the script using Mozilla Firefox Driver:
SeleniumDemo.java
package demo; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class SeleniumDemo { // variable name public static WebDriver driver; public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Launching the Mozilla Firefox driver "); // Instantiate the Mozilla Firefox driver driver = new FirefoxDriver(); // set the browser URL in get() to load the webpage driver.get("https://www.google.com"); // Close the driver driver.quit(); } }
To run and execute the code in Eclipse IDE, you need to follow the below step:
- On Eclipse's menu bar, click Run > Run.
Then it will launch the Mozilla Firefox browser and load the page.
No comments:
Post a Comment