0

I have try to run this sample code

package edsAutomation;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Example {

public static void main(String[] args) {
    // declaration and instantiation of objects/variables
    WebDriver driver = new FirefoxDriver();
    String baseUrl = "http://newtours.demoaut.com";
    String expectedTitle = "Welcome: Mercury Tours";
    String actualTitle = "";

    // launch Firefox and direct it to the Base URL
    driver.get(baseUrl);

    // get the actual value of the title
    actualTitle = driver.getTitle();

    /*
     * compare the actual title of the page witht the expected one and print
     * the result as "Passed" or "Failed"
     */
    if (actualTitle.contentEquals(expectedTitle)){
        System.out.println("Test Passed!");
    } else {
        System.out.println("Test Failed");
    }

    //close Firefox
    driver.close();

    // exit the program explicitly
    System.exit(0);
}

}

But when i run my program it show below error:

Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot 
find firefox binary in PATH. Make sure firefox is installed. OS appears to 
be: XP
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', 
java.version: '1.8.0_25'
aberna
  • 5,594
  • 2
  • 28
  • 33
Pooja
  • 1
  • 1
  • 1
  • http://stackoverflow.com/questions/20950748/cannot-find-firefox-binary-in-path-make-sure-firefox-is-installed – vins Feb 16 '15 at 05:39

1 Answers1

-1

Make sure fiefox is installed in the default location:

(Windows) C:\Program Files\Mozilla Firefox\

(64-bit Windows) C:\Program Files (x86)\Mozilla Firefox\

jmccure
  • 1,180
  • 7
  • 16