jenkins+selenium无法打开浏览器原创
金蝶云社区-廖彬植
廖彬植
0人赞赏了该文章 350次浏览 未经作者许可,禁止转载编辑于2020年11月06日 08:56:56

jenkins+selenium无法打开浏览器,报错:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

image.png


遇到了上面这个问题

有两种可能

没有chromedriver

没有找到chrome

解决方法:

1、需要指定一下chrome.exe的文件所在地址

options = webdriver.ChromeOptions()

options.binary_location = r"D:\Software\Chrome\Application\chrome.exe"

browser = webdriver.Chrome(chrome_options=options)



2、指定之后执行,报以下错误

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH

image.png


原因:找不到chromedriver所在路径


解决方法:

下载对应版本的chromedriver,将其放在两个位置:1、浏览器安装位置 2、python安装目录

image.png


image.png

赞 0