Automation Using Selenium Webdriver
Showing posts with label How to work with Firefox browser using Selenium 3.0 beta 1. Show all posts
Showing posts with label How to work with Firefox browser using Selenium 3.0 beta 1. Show all posts

Monday 31 October 2016

How to work with Firefox browser using Selenium 3.0 beta 1

How to work with Firefox browser using Selenium 3.0 beta 1

Recently selenium has launched Selenium 3.0 beta 1 jar.In this post I will show you How to work with Firefox browser using Selenium 3.0 beta 1 jar.

Please follow the below steps:
Step:1
Just like the other drivers available to Selenium from other browser vendors, Mozilla has released now an executable that will run alongside the browser

In order to work with Firefox browser using Selenium 3 beta 1 jar, you need to use separate a driver which will interact with Firefox browser called as "Geckodriver".

Please find below link for downloading latest version of geckodriver.

https://github.com/mozilla/geckodriver/releases/download/v0.9.0/geckodriver-v0.9.0-win64.zip

Step:2
System.setProperty("webdriver.gecko.driver", "path/to/geckodriver.exe");

Step:3
driver = new FirefoxDriver();

Note: Still if you are using old versions of selenium jars(selenium 2) then you can skip first two steps.

Sample Code:
public class SampleTest {

 public WebDriver driver;

 @Test
 public void setup(){

  System.setProperty("webdriver.gecko.driver", "E:/geckodriver.exe");
  driver = new FirefoxDriver();
  driver.manage().window().maximize();
  driver.get("http://www.facebook.com/");

  }

}