Ardesco/Selenium-Maven-Template

Jenkins

pkankar opened this issue · 6 comments

When I try to run the code with jenkins, it shows the following error:

Starting ChromeDriver 2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5) on port 9745
Only local connections are allowed.
Unable to capture screenshot...
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'ip-172-31-17-90', ip: '172.31.17.90', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1032-aws', java.version: '1.8.0_211'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:157)
at com.lazerycode.selenium.config.DriverType$2.getWebDriverObject(DriverType.java:43)
at com.lazerycode.selenium.config.DriverFactory.instantiateWebDriver(DriverFactory.java:104)
at com.lazerycode.selenium.config.DriverFactory.getDriver(DriverFactory.java:46)
at com.lazerycode.selenium.DriverBase.getDriver(DriverBase.java:31)
at com.lazerycode.selenium.listeners.ScreenshotListener.onTestFailure(ScreenshotListener.java:51)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1699)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1683)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:697)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:9745/status] to be available after 89479 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
... 23 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 24 more
Unable to clear cookies, driver object is not viable...

Please help me ASAP

You have to show me how you have customised it, looks like you are trying to clear cookies when you have already closed down the driver object. Does it work locally?

Im using it on jenkins sir
This is the jenkins URL : http://ec2-18-222-217-143.us-east-2.compute.amazonaws.com:8080/
username: prudhveer
password: 1234

Entire project is stored there sir, can you please check one and tell me where I am going wrong

When I am trying to run with maven, it was running , but when I used it in jenkins , its not running sir

I have only modified src/test/java/com/lazerycode/selenium/tests/GoogleExampleIT.java this file.
Rest of the code is same.
And I run it using mvn install -Dbrowser=chrome

I havent deleted any of the cookies but still it dosent work, and yes it works locally

Problems I can see:

  • The POM has been modified to use JDK 1.6, Selenium requires 1.8 as a minimum.
  • Your POM looks like it has 2 versions of TestNG which is going to cause problems and you have a bunch of unused cucumber dependencies (unless they are used somewhere else)
  • It looks like you are suffering from this Firefox error: SeleniumHQ/docker-selenium#388

Do you get the same error if you try and run your tests through chrome?