[英]Selenium chromedriver.exe
As part of my project setup, I have two projects one as libraries and other as Selenium. 作为项目设置的一部分,我有两个项目,一个作为库,另一个作为Selenium。 I have all the browser setup in libraries project with /src/main/resource having chromedriver.exe Selenium project has all the pagefactory classes and this project has dependency on Library. 我在带有chromedriver.exe的/ src / main / resource的Library项目中具有所有浏览器设置。Selenium项目具有所有pagefactory类,并且该项目对Library具有依赖性。 However when i am running project on slave I am getting following error message: 但是,当我在从属服务器上运行项目时,出现以下错误消息:
java.lang.IllegalStateException: The driver executable does not exist: c:\jenkins_slave10\workspace\TEST-Demos\file:\C:\Users\svc-hudson\.m2\repository\com\bskyb\automation\crm\libraries\1.1-SNAPSHOT\libraries-1.1-SNAPSHOT.jar!\chromedriver\windows\chromedriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:177) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:149) at com.abc.automation.crm.actions.BrowserSetup.openBrowserChrome(BrowserSetup.java:38) at com.abc.automation.crm.actions.Search.setup(Search.java:111) at com.abc.automation.crm.actions.Search.directorynumber(Search.java:35) at com.abc.automation.crm.stepdefs.Demo.i_search_for_directory_number(Demo.java:34)
Did you try setting the system property to specify the chromedriver.exe
location? 您是否尝试设置系统属性以指定chromedriver.exe
位置?
Either start the selenium server with 用以下方法启动硒服务器
-Dwebdriver.chrome.driver=c:\path\to\your\chromedriver.exe
or 要么
set the system property in your code: 在代码中设置系统属性:
System.setProperty("webdriver.chrome.driver", "C:/path/to/your/chromedriver.exe");
You should not pack chromedirver on jar. 您不应该在罐子上装chromedirver。
Try to add prebuild step in jenkins that will download chromdriver to your project folder in workspace and set relative path to it. 尝试在jenkins中添加预构建步骤,该步骤会将chromdriver下载到工作区中的项目文件夹中,并设置相对路径。
Error is saying that the path you have specified is not correct path. 错误是您指定的路径不正确。
System.setProperty("webdriver.chrome.driver", "/home/path/Downloads/chromedriver"); // specify complete path.
WebDriver webDriver = new ChromeDriver();
Might be possible that chrome driver is not compatible with OS. chrome驱动程序可能与OS不兼容。 You have to check this. 您必须检查一下。 You can download driver from http://chromedriver.storage.googleapis.com/index.html?path=2.16/ and extract .zip file. 您可以从http://chromedriver.storage.googleapis.com/index.html?path=2.16/下载驱动程序并解压缩.zip文件。
Error is saying that the path you have specified is not correct. 错误是您指定的路径不正确。
System.setProperty("webdriver.chrome.driver", "c://jars//imp//IEDriverServer.exe"); // complete path.
WebDriver webDriver = new ChromeDriver();
I think you are missing specify your path with double '//' like below 我认为您缺少使用双'//'指定路径的方法,如下所示
c://jars//imp//IEDriverServer.exe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.