我收到错误:
Failed: org.openqa.selenium.WebDriverException Cannot find firefox binary in PATH, make sure firefox is installed. OS appears to be WIN8
我在Selenium v 2.30
Firefox v.19
和windows 8 64bit
相同的代码在windows7 / SP1上完美运行。
if(browser == SupportedBrowser.FIREFOX) {
//firefox driver is built into selenium standalone server
return new FirefoxDriver();
}
答案 0 :(得分:3)
PATH
firefox.exe
某处他没有帮助然后像这样更改构造函数:
if(browser == SupportedBrowser.FIREFOX) {
File pathToBinary = new File("path/to/firefox.exe");
FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
FirefoxProfile firefoxProfile = new FirefoxProfile();
FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile);
return _driver;
}
答案 1 :(得分:0)
你可以做到
System.setProperty("webdriver.firefox.bin","PATH_TO_BINARY");