webdriver + jenkins执行用例报“unknown error: cannot find Chrome binary”

引自:https://blog.csdn.net/dreamtl/article/details/53486563

在eclipse ide中好着的,但集成到jenkins报错:org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary

解决方法:

分析:可能是因没有定位chrome浏览器的位置,找不到binary ,所以报错,增加红框语句:

System.setProperty("webdriver.chrome.driver", "files/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("chrome.exe路径");
ChromeDriver driver = new ChromeDriver(options);

然后打断点发现:binary是有值的;重启jenkins好了;
 

发布了6 篇原创文章 · 获赞 10 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/vicky_lov/article/details/83343260