My Thoughts: org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.

Tuesday, March 5

org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.

If you running webdriver scripts on Windows 8 then the below error is the first one you will encounter. Atleast it happened for me :) .


org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN8
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'
System info: os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_09'
Driver info: driver.version: FirefoxDriver



The solution to the above problem is to specify the location of firefox in your script .
System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");

Here is my modified script.And it went through without any errors :)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class FacebookRegistration {

WebDriver driver;
 
 @BeforeTest
 public void start(){
  System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
  driver = new FirefoxDriver();
 }
 

 @Test
 public void run(){
  driver.get("http://facebook.com");
 }
}

4 comments:

  1. Use the normal SendKeys() to set the text.

    ReplyDelete
  2. Please, I need help to do copy and paste. I copied a text that is automatically generated as order number. I opened another link and wan to paste the copied text in a field. what script paste a text in webdriver.

    ReplyDelete
  3. I hope below post helps you

    http://www.mythoughts.co.in/2012/12/sending-special-characters-and-key.html

    ReplyDelete
  4. Hi please use webdriver.firefox.driver instead .bin for backword compatiblity

    ReplyDelete