简体   繁体   中英

WebDriver, ChromeDriver, Selenium, and Jenkins Integration

I have a selenium script written in eclipse, which invokes a ChromeDriver that launches a URL, reads title and closes the browser. I'm able to successfully execute this in Eclipse and also at a command prompt.

However, when I create a Jenkins job with a build routine (via execute batch command) the build keeps running for a long time. Upon tracing with sysout statements, I found that the build is stopping at drive.get()

driver.get("google.com");

The build fails with the error message below after waiting for a long time:

Starting ChromeDriver 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3) on port 39626
Only local connections are allowed.
[304.538][SEVERE]: Timed out receiving message from renderer: 298.714
[904.539][SEVERE]: Timed out receiving message from renderer: 600.000
[914.540][SEVERE]: Timed out receiving message from renderer: 10.000

Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

Selenium Webdriver actually needs display to work (X server to be accurate).

You can use Xvfb to run it in a headless mode, detailed instruction (a bit outdated, but still valid) - http://alex.nederlof.com/blog/2012/11/19/installing-selenium-with-jenkins-on-ubuntu/

You have to change the code to

driver.get("http://google.com");

you must have seen error running from eclipse and command prompt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM