If you running webdriver scripts on Windows 8 then the below error is the first one you will encounter. Atleast it happened for me :) .
The solution to the above problem is to specify the location of firefox in your script .
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"); } }