簡體   English   中英

硒測試引發WebDriver異常

[英]Selenium testing is throwing webdriver exception

我們正在Jenkins的Windows Machine中進行硒測試。 我在C:\\ Selenium \\ path下添加了ChromeDriver 2.36。 我的Selenium_Server_standalone_2.53.0.jar放在C:\\ Selenium下。 Chrome瀏覽器版本為65。執行測試時,發現Chromedriver路徑設置不正確的問題。

**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

您所看到的錯誤說明了一切:

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

日志消息清楚地表明,已檢測到ChromeDriver 2.36.540470 ,並且已成功啟動瀏覽會話以打開瀏覽器客戶端

但是在下一步中,當瀏覽器客戶端嘗試與驅動程序服務器(ChromeDriver )通信時,通信失敗,因為JVM最初知道的ChromeDriver路徑即C:/Selenium/path/SeleniumChromeDriver.exe可能已通過Jenkins更改配置 由於瀏覽器客戶端無法在先前已知的位置與ChromeDriver通信,並且找不到它,因此引發WebDriverException ,如下所示:

org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM