0

We are carrying out selenium tests in windows Machine from Jenkins. I have added the ChromeDriver 2.36 under C:\Selenium\path. My Selenium_Server_standalone_2.53.0.jar is placed under C:\Selenium. Chrome Browser Version is 65. While executing the test am seeing issue with Chromedriver path not being set properly.

**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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • What exactly are you doing within `String strChromeDriverPath = strConfigValues[18];`? – undetected Selenium Mar 20 '18 at 11:45
  • @DebanjanB getting string from string array probably and i guess it is this one C:/Selenium/path/SeleniumChromeDriver.exe – xMilos Mar 20 '18 at 12:25
  • I recommend testing with latest chrome driver, also try setting string to C:\\Selenium\\path\\SeleniumChromeDriver.exe – xMilos Mar 20 '18 at 12:26
  • check https://stackoverflow.com/questions/38676719/selenium-using-java-the-path-to-the-driver-executable-must-be-set-by-the-webdr – xMilos Mar 20 '18 at 12:28

1 Answers1

0

The error you are seeing says it all :

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

The log messages clearly says that ChromeDriver 2.36.540470 was detected and a Browsing Session was initiated successfully to open the Browser Client.

But in the next step when the Browser Client tried to communicate back to the Driver Server i.e. ChromeDriver, the communication failed as the path of ChromeDriver initially known by JVM i.e. C:/Selenium/path/SeleniumChromeDriver.exe might have got changed through the Jenkins Configuration. As the Browser Client fails to communicate with the ChromeDriver at the previously known location and doesn't finds it a WebDriverException is raised as follows :

org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property;
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352