可通过FirefoxBinary 来指定运行某个路径下的Firefox, 示例代码如下:
public class testFirefoxBinary{
public static void main(String[] args){
FirefoxBinary firefoxBinary = new FirefoxBinary(new File("/path/to/chrome"));
FirefoxProfile firefoxProfile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(firefoxBinary, firefoxProfile);
driver.get("http://www.baidu.com");
driver.close();
}
}