Sunday, 7 August 2016

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.way2selenium.com/");

}

}






6 comments:

  1. Sudharshan, i already tried this with ff48.1 version , no luck i am getting error similar to ff browser mismatch.
    Have you tried on Ff48.1 with selenium 3 beta 1 ?

    ReplyDelete
  2. Sudharshan, i already tried this with ff48.1 version , no luck i am getting error similar to ff browser mismatch.
    Have you tried on Ff48.1 with selenium 3 beta 1 ?

    ReplyDelete
    Replies
    1. In order to work with latest version of Firefox, you have to use selenium 3 beta version.

      Delete
  3. Hi,

    Thank for great solution. I m using Selenium 3 beta version with 48. and it's working for me.

    following code i am using:

    System.setProperty("webdriver.gecko.driver","D:/Dheeraj/HCL/Geckodriver/geckodriver.exe");
    WebDriver driver;
    driver = new FirefoxDriver();

    driver.get("https://google.com");

    ReplyDelete