0

While executing my suite dynamically on grid using Docker-compose through Jenkins, I am getting the following exception stacktrace:

org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '49d4c6ec544d', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '1.8.0_292'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at WebdriverBase.GridDriverManager.setDriver(GridDriverManager.java:144)
    at WebdriverBase.GridDriverManager.getDriver(GridDriverManager.java:115)
    at stepdefinition.PurchaseWorkflow.init(PurchaseWorkflow.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

My docker-compose.yml file: enter image description here

My Hub URL : "http://selenium-hub:4444/wd/hub"

When executing the same code on local system everything is working fine on Docker container. Problem arises only when I trigger my test from Jenkins.

Daniyal
  • 11
  • 2
RISHI KHANNA
  • 354
  • 5
  • 23

2 Answers2

1

This is an old thread but hoping to help anyone out here, not an exact answer as I am just using the standalone browser of selenium but I have the

http://service-name:4444/wd/hub

working in my file.

await new Builder()
.setChromeOptions(options)
.forBrowser("chrome")
.usingServer("http://selenium:4444/wd/hub/")
.build();

Make sure in your docker-compose.yaml file to also use a link in the other service. for example

services:   
    web:

        build:
            context: ./web
        links:
            - selenium
        ports:
            - "443:443"
Scott Cooper
  • 149
  • 2
  • 8
-1

Try witch shm_size: 2gb in volumes

  • Actually there was 2 issues- 1) Have to use Options class instead of desired capabilities class and 2) When executed from Jenkins image, Hub IP address needs to be my network IP, localhost won't work. – RISHI KHANNA Jul 21 '21 at 08:16