Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://172.17.0.1:4444/wd/hub/session/1e5f379f0532f667f3bf7505a142a91b/url timed out after 60 seconds. #48

Closed
Benny86 opened this issue Jul 6, 2018 · 12 comments

Comments

@Benny86
Copy link

Benny86 commented Jul 6, 2018

Not sure this is a bug, please double check. If not, please specify the correct/supported way. Thanks

1.Setup Selenoid container on host automatically:
curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --browser "chrome"

  1. We can see the container created successfully
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    4faae28f028e aerokube/selenoid:1.6.2 "/usr/bin/selenoid -…" 19 minutes ago Up 19 minutes 0.0.0.0:4444->4444/tcp selenoid

and it's container logs:
2018/07/06 05:23:19 [-] [INIT] [Loading configuration files...]
2018/07/06 05:23:19 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
2018/07/06 05:23:19 [-] [INIT] [Using default containers log configuration because of: read error: open config/container-logs.json: no such file or directory]
2018/07/06 05:23:19 [-] [INIT] [Using Docker API version: 1.37]
2018/07/06 05:23:19 [-] [INIT] [Timezone: Local]
2018/07/06 05:23:19 [-] [INIT] [Video Dir: /opt/selenoid/video]
2018/07/06 05:23:19 [-] [INIT] [Listening on :4444]

curl http://localhost:4444/status
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"66.0":{},"67.0":{}},"firefox":{"59.0":{},"60.0":{}},"opera":{"52.0":{},"53.0":{}}}}

curl http://localhost:4444/wd/hub
Moved Permanently.

  1. Initialized remote web driver as below
    var url = "http://172.17.0.1:4444/wd/hub";
    driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

Notes: 172.17.0.1 is docker0 ip

  1. We run selenoid case in pipeline: jenkinsfile -> dockerfile, initial remote web driver failed with below error message:

2018/07/06 05:14:05 [0] [CREATING_CONTAINER] [selenoid/vnc_chrome:67.0]
2018/07/06 05:14:05 [0] [SERVICE_STARTUP_FAILED] [create container: Error: No such image: selenoid/vnc_chrome:67.0]

Notes: It should be installed during step 1 automatically, right?

  1. So we install image: selenoid/vnc_chrome:67.0 manually on host before run step 1
    docker pull selenoid/vnv_chrome:67.0

Notes: docker pull selenoid/vnc_chrome doesn't work for us, normally it should auto go the latest one, right?

  1. And then run case again, but still failed with timeout errors:

Error Message:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://172.17.0.1:4444/wd/hub/session/1e5f379f0532f667f3bf7505a142a91b/url timed out after 60 seconds.
---- System.Net.WebException : The operation has timed out.
Stack Trace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
at SM_Regression.TestScripts.IncidentManagement.INC_create_001.step_001_OpenNewIncident() in /tmp/jenkins/data/docker/workspace/Selenoid-job/SM_Regression/TestScripts/IncidentManagement/INC_create_001.cs:line 40
----- Inner Stack Trace -----
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)

@vania-pooh
Copy link
Member

@Benny86 your commands seem to be correct. However if you already have a ~/.aerokube/selenoid/browsers.json on the host where you start cm then you need to add --force flag to overwrite this file. E.g. command could be:

curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --browser "chrome" --vnc --force

Otherwise you may have inconsistency between browsers.json file and already pulled images.

@vania-pooh
Copy link
Member

@Benny86 Timeout in /url operation can be caused by corporate firewall rules blocking access to static resources. You can use Selenoid UI and VNC feature or video recording to see why it's happening

@Benny86
Copy link
Author

Benny86 commented Jul 6, 2018

@vania-pooh 1st error not prompts on after add "--force", Thanks. But the for timeout issue is still here, you can see the timeout url are weird: "http://172.17.0.1:4444/wd/hub/session/1dab75ab205e3b463e10aeaf5a882c36/url", right?

As you said, to see the details by Selenoid UI, VNC feature or video recording, how to do it?

@Benny86
Copy link
Author

Benny86 commented Jul 6, 2018

@vania-pooh
When setup Selenoid container on host by below:
curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --browser "chrome" --force

from its logs, we can see the Selenoid video has been setup and enabled

$ docker logs fc44
2018/07/06 06:57:16 [-] [INIT] [Loading configuration files...]
2018/07/06 06:57:16 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
2018/07/06 06:57:16 [-] [INIT] [Using default containers log configuration because of: read error: open config/container-logs.json: no such file or directory]
2018/07/06 06:57:16 [-] [INIT] [Using Docker API version: 1.37]
2018/07/06 06:57:16 [-] [INIT] [Timezone: Local]
2018/07/06 06:57:16 [-] [INIT] [Video Dir: /opt/selenoid/video]
2018/07/06 06:57:16 [-] [INIT] [Listening on :4444]
2018/07/06 07:02:11 [-] [NEW_REQUEST] [unknown] [172.17.0.1]
2018/07/06 07:02:11 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.1]
2018/07/06 07:02:11 [0] [LOCATING_SERVICE] [chrome] []
2018/07/06 07:02:11 [-] [DEFAULT_VERSION] [Using default version: 67.0]
2018/07/06 07:02:11 [0] [USING_DOCKER] [chrome] [67.0]
2018/07/06 07:02:11 [0] [CREATING_CONTAINER] [selenoid/vnc_chrome:67.0]
2018/07/06 07:02:11 [0] [STARTING_CONTAINER] [selenoid/vnc_chrome:67.0] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f]
2018/07/06 07:02:13 [0] [CONTAINER_STARTED] [selenoid/vnc_chrome:67.0] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f] [1.88s]
2018/07/06 07:02:14 [0] [SERVICE_STARTED] [selenoid/vnc_chrome:67.0] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f] [1.03s]
2018/07/06 07:02:14 [0] [PROXY_TO] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f] [http://172.17.0.6:4444/]
2018/07/06 07:02:14 [0] [SESSION_ATTEMPTED] [http://172.17.0.6:4444/] [1]
2018/07/06 07:02:28 [0] [SESSION_CREATED] [1dab75ab205e3b463e10aeaf5a882c36] [1] [17.82s]
2018/07/06 07:03:29 [4] [SESSION_TIMED_OUT] [1dab75ab205e3b463e10aeaf5a882c36]
2018/07/06 07:03:29 http: proxy error: context canceled
2018/07/06 07:03:29 [5] [SESSION_DELETED] [1dab75ab205e3b463e10aeaf5a882c36]
2018/07/06 07:03:59 [4] [DELETE_FAILED] [1dab75ab205e3b463e10aeaf5a882c36] [Delete http://127.0.0.1:4444/wd/hub/session/1dab75ab205e3b463e10aeaf5a882c36: context deadline exceeded]
2018/07/06 07:03:59 http: proxy error: context canceled
2018/07/06 07:03:59 [0] [REMOVING_CONTAINER] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f]
2018/07/06 07:04:00 [0] [CONTAINER_REMOVED] [7b148f32c2bafa3b2b9455d57eafc643ca96a386808c244448e918bf9110213f]

, but we cannot find anything under the /opt folder, it's expected to have selenoid/video here, right?
$ ls
bin boot config dev distelli etc home initrd.img initrd.img.old lib lib64 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz vmlinuz.old writetrace.scap.gz
$ cd opt
/opt$ ls

on page: https://aerokube.com/selenoid/latest/#_video_recording_enablevideo_videoname_videoscreensize_videoframerate, which saide to add "enableVideo:true" and "videoName: "my-cool-video.mp4"..., how to do it?

BTW, is there another way to locate current url timeout issues?

@vania-pooh
Copy link
Member

@Benny86 1) You can add enableVideo like this: https://github.com/vania-pooh/demo-test/blob/master/src/test/java/com/aerokube/selenoid/AndroidDemoTest.java#L35
2) You can also start an empty container with Ubuntu and try to curl your urls. An error like this:

2018/07/06 07:03:59 [4] [DELETE_FAILED] [1dab75ab205e3b463e10aeaf5a882c36] [Delete http://127.0.0.1:4444/wd/hub/session/1dab75ab205e3b463e10aeaf5a882c36: context deadline exceeded]

very frequently means - that our server or virtual machine is overloaded.

@Benny86
Copy link
Author

Benny86 commented Jul 9, 2018

@vania-pooh What's kind of data would be filled for "version", 'app", "appPackage" and "appActivity"? BTW, I use chrome here, and host is azure/ubuntu

final DesiredCapabilities device = new DesiredCapabilities();
29 device.setCapability("browserName", "android");
30 device.setCapability("version", "6.0");
31 // device.setCapability("app", "http://download.example.com/test.apk"); // Uncomment this to download your own APK

32 device.setCapability("appPackage", "com.android.calculator2"); // Set this to your APK package
33 device.setCapability("appActivity", "com.android.calculator2.Calculator"); // Set this to your APK main activity

34 device.setCapability("enableVNC", true); // Uncomment this to record
35 // device.setCapability("enableVideo", true); // Uncomment this to record video
36

37 driver = new RemoteWebDriver(new URL(
38 "http://selenoid.example.com:4444/wd/hub" //Replace with correct host and port
39 ), device);

@Benny86
Copy link
Author

Benny86 commented Jul 9, 2018

@vania-pooh you said :"very frequently means - that our server or virtual machine is overloaded.", any suggestions to fix it? Thanks.

@vania-pooh
Copy link
Member

vania-pooh commented Jul 9, 2018

@Benny86 just take a look at system metrics as CPU consumption, memory consumption, load average, disk consumption and increase number of CPUs / any other stuff accordingly if needed.

@Benny86
Copy link
Author

Benny86 commented Jul 9, 2018

@vania-pooh Issues have been resolved. Actually, this is caused by the DNS changed of target testing environment, after switch to another environment, case passed. Thanks.

@Benny86
Copy link
Author

Benny86 commented Jul 9, 2018

@vania-pooh We will do much more investigation to use Selenoid from a push pipeline, that means no manual steps to install selenoid container on host. If possible, I will ping you for any questions or issues here. Thanks for your supports.

@vania-pooh
Copy link
Member

@Benny86 sure. I have seen a set of similar issues created during this investigation. Feel free to close any issues that are already resolved.

@Benny86 Benny86 closed this as completed Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants