images icon indicating copy to clipboard operation
images copied to clipboard

Unexpected error. unknown command: wd/hub/session

Open Benny86 opened this issue 6 years ago • 9 comments

I am trying to run selenoid based auto-case by sidecar container, but failed with errors: "Unexpected error. unknown command: wd/hub/session". Not sure any other configurations need to be considered here? Please specify them. Thanks a lot.

Below are the detail configurations:

Jenkinsfile: _node { checkout scm

docker.image('selenoid/chrome').withRun("--name selenoid -p 4444:4444") { c ->
		echo 'hello world'
		sh 'curl http://localhost:4444/wd/hub'
		sh 'curl http://localhost:4444/status'
	docker.image('microsoft/dotnet').inside(" -u root:root --link ${c.id}:selenoid") {
		sh 'curl http://selenoid:4444/wd/hub'
		sh 'curl http://selenoid:4444/status'
		sh 'pwd && ls && dotnet build && cd SM_Regression && dotnet test'
    }
}

}_

Initialize remote web driver in dotnet code as below: var url = "http://selenoid:4444/wd/hub"; driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

On Host: _:/$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f64270768658 microsoft/dotnet "cat" 9 seconds ago Up 8 seconds cranky_chandrasekhar 465ff22c8bdb selenoid/chrome "/usr/bin/microinit …" 16 seconds ago Up 15 seconds 0.0.0.0:4444->4444/tcp selenoid

:/$ docker logs 465ff Waiting xvfb... Starting ChromeDriver 2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf) on port 4444 All remote connections are allowed. Use a whitelist instead! Failed to read: session.ignoreBorder Setting default value Failed to read: session.forcePseudoTransparency Setting default value Failed to read: session.colorsPerChannel ... Setting default value Failed to read: session.screen0.toolbar.onhead Setting default value Failed to read: session.screen0.toolbar.placement Setting default value Failed to read: session.screen0.toolbar.height Setting default value

:/$ curl http://localhost:4444/status {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-130-generic"}}}

:/$ curl http://localhost:4444/wd/hub unknown command: wd/hub_

Jenkins logs: _[Pipeline] { [Pipeline] sh

[Selenoid-job] Running shell script

  • curl http://selenoid:4444/wd/hub % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 23 100 23 0 0 4156 0 --:--:-- --:--:-- --:--:-- 4600 unknown command: wd/hub[Pipeline] sh

[Selenoid-job] Running shell script

  • curl http://selenoid:4444/status % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 133 100 133 0 0 24309 0 --:--:-- --:--:-- --:--:-- 129k {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-130-generic"}}}[Pipeline] sh [Selenoid-job] Running shell script_

Benny86 avatar Jul 23 '18 15:07 Benny86

@Benny86 for Chrome containers Selenium URL path should be / and not /wd/hub, e.g. http://localhost:4444/.

vania-pooh avatar Jul 23 '18 15:07 vania-pooh

@vania-pooh Based on your suggestions, we updated it to below, but still failed with errors: "The HTTP request to the remote WebDriver server for URL http://selenoid:4444/session timed out after 60 seconds."

Jenkinsfile: node { checkout scm

docker.image('selenoid/chrome').withRun("--name selenoid -p 4444:4444") { c ->
		echo 'hello world'
		sh 'curl http://localhost:4444/'
		sh 'curl http://localhost:4444/status'
	docker.image('microsoft/dotnet').inside(" -u root:root --link ${c.id}:selenoid") {
		sh 'curl http://selenoid:4444/'
		sh 'curl http://selenoid:4444/status'
		sh 'pwd && ls && dotnet build && cd SM_Regression && dotnet test'
    }
}

}

Initialize remote web driver in dotnet code as below: var url = "http://selenoid:4444/"; driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

Jenkins logs: [Pipeline] { [Pipeline] sh

[Selenoid-job] Running shell script

  • curl http://selenoid:4444/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 17 100 17 0 0 3119 0 --:--:-- --:--:-- --:--:-- 3400 unknown command: [Pipeline] sh [Selenoid-job] Running shell script

  • curl http://selenoid:4444/status % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 133 100 133 0 0 16055 0 --:--:-- --:--:-- --:--:-- 16625 {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-130-generic"}}}[Pipeline] sh [Selenoid-job] Running shell script

Benny86 avatar Jul 23 '18 15:07 Benny86

@Benny86 that's a network issue with Docker.

vania-pooh avatar Jul 23 '18 15:07 vania-pooh

@vania-pooh How to fix it?

Benny86 avatar Jul 23 '18 15:07 Benny86

@Benny86 euh, depends on Docker version and host operating system type. I would consult Docker forums.

vania-pooh avatar Jul 23 '18 16:07 vania-pooh

@vania-pooh Please let me know once you've got any updates. Thanks.

Benny86 avatar Jul 23 '18 16:07 Benny86

@Benny86 for Chrome containers Selenium URL path should be / and not /wd/hub, e.g. http://localhost:4444/.

So in this case Selenoid configurator or UI does not work properly.

./cm selenoid configure --vnc --tmpfs 128 --browsers "firefox:>=55;opera:>=46;chrome:>=60

And the result is as on the image I've posted above

piotrkochan avatar Dec 17 '19 09:12 piotrkochan

@piotrkochan Opera driver is buggy and requires manually specifying path to browser binary. This is noted here: https://aerokube.com/selenoid/latest/#_opera

vania-pooh avatar Dec 18 '19 03:12 vania-pooh