2.1.0 requires minimum docker version?

82 Views Asked by At

I'm trying to evaluate Selenium-Jupiter, but get different problems, behavior depending on what version I use.

I'm using gradle 4.6 and

> docker version | grep API
API version:     1.24
API version:     1.24

When using io.github.bonigarcia:selenium-jupiter:2.1.0

gradle clean test --info
...
 Caused by:
    io.github.bonigarcia.SeleniumJupiterException: io.github.bonigarcia.SeleniumJupiterException: com.spotify.docker.client.exceptions.ContainerNotFoundException: Container not found: c222d04fa9726606939b34d27565345d5462dbc9e6744e438a662099325c573a

        Caused by:
        io.github.bonigarcia.SeleniumJupiterException: com.spotify.docker.client.exceptions.ContainerNotFoundException: Container not found: c222d04fa9726606939b34d27565345d5462dbc9e6744e438a662099325c573a

            Caused by:
            com.spotify.docker.client.exceptions.ContainerNotFoundException: Container not found: c222d04fa9726606939b34d27565345d5462dbc9e6744e438a662099325c573a

                Caused by:
                com.spotify.docker.client.exceptions.DockerRequestException: Request error: POST unix://localhost:80/containers/c222d04fa9726606939b34d27565345d5462dbc9e6744e438a662099325c573a/start: 404, body: {"message":"invalid header field value \"oci runtime error: container_linux.go:247: starting container process caused \\\"exec: \\\\\\\"\\\\\\\": executable file not found in $PATH\\\"\\n\""}

                    Caused by:
                    javax.ws.rs.NotFoundException: HTTP 404 Not Found

When using io.github.bonigarcia:selenium-jupiter:2.0.0

gradle clean test --info
...
 Caused by:
    io.github.bonigarcia.SeleniumJupiterException: io.github.bonigarcia.SeleniumJupiterException: org.openqa.selenium.WebDriverException: create container: Error response from daemon: client is newer than server (client API version: 1.30, server API version: 1.24) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 31 milliseconds
    Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
    System info: host: 'xxxx', ip: '10.167.6.18', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.21.1.el7.x86_64', java.version: '1.8.0_131'
    Driver info: driver.version: RemoteWebDriver

        Caused by:
        io.github.bonigarcia.SeleniumJupiterException: org.openqa.selenium.WebDriverException: create container: Error response from daemon: client is newer than server (client API version: 1.30, server API version: 1.24) (WARNING: The server did not provide any stacktrace information)
        Command duration or timeout: 31 milliseconds
        Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
        System info: host: 'xxxx', ip: '10.167.6.18', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.21.1.el7.x86_64', java.version: '1.8.0_131'
        Driver info: driver.version: RemoteWebDriver

            Caused by:
            org.openqa.selenium.WebDriverException: create container: Error response from daemon: client is newer than server (**client API version: 1.30, server API version: 1.24**) (WARNING: The server did not provide any stacktrace information)
            Command duration or timeout: 31 milliseconds
            Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
            System info: host: 'xxxx', ip: '10.167.6.18', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.21.1.el7.x86_64', java.version: '1.8.0_131'
            Driver info: driver.version: RemoteWebDriver

I assume some config is needed of the interaction between Selenium-Jupiter and Selenoid, like DOCKER_API_VERSION as described here http://aerokube.com/selenoid/latest/#_recommended_docker_settings but I don't know of where to do this config from Selenium-Jupiter side of things.

I realize that this is a rather vage shout for help but hope that someone at least can give me some hint och pointer on how to solve this. I really like the idea about using Docker for this kind of virtualization and I think our GUI tests really could benefit from a solution like this.

1

There are 1 best solutions below

0
Boni García On

You can change the version of the Docker API used by Selenium-Jupiter as follows:

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.WebDriver;

import io.github.bonigarcia.seljup.SeleniumExtension;

public class MyTest {

    @RegisterExtension
    static SeleniumExtension seleniumExtension = new SeleniumExtension();

    @BeforeAll
    static void setup() {
        seleniumExtension.getConfig().setDockerApiVersion("API-version"); // 1.35 by default
    }

    @Test
    void test(WebDriver driver) {
        // your test
    }

}

I would use the latest version of Selenium-Jupiter, 3.1.0 at the time of this writing.