当我用蚀进行python-selenium测试时,它可以正常工作。如果我将Python测试添加为Jenkins中的批处理文件,我总是会遇到此错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
我正确地在Windows中设置了Python的路径。任何人都可以帮忙吗?谢谢。
我设定了这样的路: self.driver = webdriver.Chrome("C://Selenium-driver//chromedriver.exe")
pts = webdriver.ChromeOptions()
opts.binary_location = ("C://Users//me//AppData//Local//Google //Chrome//Application//chrome.exe")
driver = webdriver.Chrome(chrome_options = opts)
我在Jenkins中使用Execute Windows Batch命令在Jenkins中运行批处理文件: call "c:myfolderlogin_python2.bat"
批处理文件是:
@echo off
cd C:UsersmeAppDataLocalProgramsPythonPython36
python C:UsersmeNEONworkspaceTest1test-packagetest.py
确保将铬安装在C:Program Files
默认情况下,它将在AppData文件夹中安装自身。尝试使用独立的Chrome安装程序重新安装Chrome。