Thursday 21 March 2013

Selenium: Webdriver Exception:-Cannot find firefox binary in PATH

Hi Folks,

Recently I stuck up with an issue called "Cannot find firefox binary in PATH" while trying to run my selenium webdriver script. Later I found that selenium doesn't get the source path where the firefox browser is installed. To overcome the following issue specify the browser path to open by the selenium as follows,

Code:


@Before
  public void setUp() throws Exception {
System.setProperty("webdriver.firefox.bin","C:\\Program Files (x86)\\Mozilla Firefox\\Firefox.exe");
driver = new FirefoxDriver();
        baseUrl = "http://www.google.co.in";
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

System.setProperty("webdriver.firefox.bin","C:\\Program Files (x86)\\Mozilla Firefox\\Firefox.exe"); 

The above code helps to set the path where the firefox is installed.

Happy testing.

1 comment: