I have created object of Firefoxprofile and FireboxBinary class , so that Selenium can identify the firefox and run it.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
public class Test1 {
public static void main(String[] args) {
File f = new File("C:\\Program Files (x86)\\Mozilla Firefox15\\firefox.exe") FirefoxBinary binary = new FirefoxBinary(f);
FirefoxBinary binary = new FirefoxBinary(f);
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("webdriver.firefox.bin", "C:/Program Files (x86)/Mozilla Firefox15/");
WebDriver wd = new FirefoxDriver(binary,profile);
String baseURL = "http:/www.yahoo.com";
String actualTitle="";
String expectedTitle="Yahoo";
wd.get(baseURL);
actualTitle = wd.getTitle();
if( actualTitle.contentEquals(expectedTitle)) {
System.out.println("Matched -" + actualTitle);
} else{
System.out.println("Not Matched - "+actualTitle);
}
}
}