Jenkins is showing message starting the chromedriver but the chromedriver is not triggered and testcase fails.i dont know why it is happening
Note: the xml created for this code runs successfully on terminal.i think issue is with chromedriver
SELENIUM CODE:
public class cmddd {
@Test
public void f() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "/home/dev2/Downloads/newchromedriver/chromedriver");
WebDriver m = new ChromeDriver();
m.get("https://www.google.com/");
System.out.println("passed");
}
}
JENKINS OUTPUT:
Building in workspace /home/dev2/eclipse-workspace/seffcon
[seffcon] $ /bin/sh -xe /tmp/jenkins170843147783066328.sh
+ ./cd.sh
[TestNG] Running:
/home/dev2/eclipse-workspace/seffcon/cd.xml
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Check your chromedriver version and chromebrowser version. I had noticed this behaviour when there is a version mismatch.
You can refer this link http://chromedriver.chromium.org/downloads
This error message...
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- You are using chromedriver=2.40
- Release Notes of chromedriver=2.40 clearly mentions the following :
Supports Chrome v66-68
- Possibly you are using the latest Chrome Browser i.e. chrome=72.0
- As per ChromeDriver - WebDriver for Chrome:
- If you are using Chrome version 73, please download ChromeDriver 73.0.3683.20
- If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
- If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137
- For older version of Chrome, please see this discussion for the version of ChromeDriver that supports it.
Solution
- Upgrade Chrome version to Chrome v72 level.
- As per ChromeDriver - WebDriver for Chrome upgrade ChromeDriver to ChromeDriver v2.46 or ChromeDriver 72.0.3626.69.
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
.
- Always invoke
driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.