selenium无法正常运行 Chrome浏览器,cannot find Chrome binary的问题
有些同学在运行selenium-chrome时会遇到这个问题,
System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
WebDriver driver = new ChromeDriver();
看代码,我们并没有什么问题,那如何解决呢?添加一行试一下,
System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
System.setProperty("webdriver.chrome.bin", "C:/Chrome/Application/chrome.exe");
WebDriver driver = new ChromeDriver();
貌似问题依然存在,那么该如何是好?直接针对Binary来进行修复问题,添加二进制文件地址
System.setProperty("webdriver.chrome.driver", "files/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C:/Chrome/Application/chrome.exe");
ChromeDriver driver = new ChromeDriver(options);
如何?
问题解决了!
文章来自:http://www.cnblogs.com/iceb/p/7762030.html