码迷,mamicode.com
首页 > 其他好文 > 详细

selenium无法正常运行 Chrome浏览器,cannot find Chrome binary的问题

时间:2017-10-31 16:50:53      阅读:736      评论:0      收藏:0      [点我收藏+]

标签:修复   sys   ons   pre   file   .exe   web   针对   sel   

有些同学在运行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); 

如何?

问题解决了!

selenium无法正常运行 Chrome浏览器,cannot find Chrome binary的问题

标签:修复   sys   ons   pre   file   .exe   web   针对   sel   

原文地址:http://www.cnblogs.com/iceb/p/7762030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!