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

05 January, 2014
This exception may popup if you are running WebDriver scripts on Windows 8.

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 this exception is to specify the location of Firefox in your script.


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

The modified script now looks like below. The test worked fine.


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 TumblrSignup {  
  
 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("https://www.tumblr.com/");  
 }  
}

No comments:

Post a Comment