【发布时间】:2018-03-20 21:05:51
【问题描述】:
我们正在 Jenkins 的 windows Machine 中进行硒测试。我在 C:\Selenium\path 下添加了 ChromeDriver 2.36。我的 Selenium_Server_standalone_2.53.0.jar 放在 C:\Selenium 下。 Chrome 浏览器版本为 65。在执行测试时,我发现 Chrome 驱动程序路径设置不正确。
**Path being added in config file :** ChromeDriver=C:/Selenium/path/SeleniumChromeDriver.exe
**Path being set in source code**:
String strChromeDriverPath = strConfigValues[18];
File fileChromeDriver = new File(strChromeDriverPath);
System.out.println("Chrome Driver Path: "+ fileChromeDriver.getAbsolutePath());
System.setProperty("webdriver.chrome.driver",fileChromeDriver.getAbsolutePath());
**Logs:**
01:49:43 [testng] Chrome Driver Path: C:\Selenium\path\SeleniumChromeDriver.exe
01:49:43 [testng] Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 5553
01:49:43 [testng] Only local connections are allowed.
01:49:45 [testng] org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
01:49:45 [testng] Command duration or timeout: 17 milliseconds
【问题讨论】:
-
你在
String strChromeDriverPath = strConfigValues[18];中到底在做什么? -
@DebanjanB 可能从字符串数组中获取字符串,我猜是这个 C:/Selenium/path/SeleniumChromeDriver.exe
-
我建议使用最新的 chrome 驱动进行测试,也可以尝试将字符串设置为 C:\\Selenium\\path\\SeleniumChromeDriver.exe
标签: java google-chrome selenium selenium-webdriver selenium-chromedriver