Open NavySeal5 opened 5 years ago
@NavySeal5 is network name selenoid_internal
?
yes, the folder the docker-compose file is in is called selenoid, so the network docker creates is called selenoid_internal, also selenoid does work with the prebuilt containers (chrome/firefox) just not with my own built ones
@NavySeal5 two possible reasons:
1) Your containers are starting too slowly. In that case you just need to increase -service-startup-timeout
e.g. to 1m
.
2) There is an issue in image and for some reason it takes a lot of time to start webdriver.
I have seem the windows VM take a bit longer than native chrome or firefox containers to start. I also added to the selenoid server the start with the following params, so the test don't fail due to a time out:
./cm selenoid start --browsers-json ~/config/browsers.json --force --args "-limit 20 -session-attempt-timeout 3m -service-startup-timeout 3m"
@vania-pooh
I don't think that this is actually the problem here, since when manually starting the containers they seem to be ready within a minute (able to connect to vnc and start tests)
I also dont think that this might be the issue, since i created the memory snapshot of the windows-vm with webdriver already running, so as soon as the vm runs, the webdriver also runs
@emilorol As mentioned above i dont think my main issue here is the time it takes to start those containers, but more of a proxying/networking problem I have tried to set the timeout to up to 10 minutes, but still get the same Problem Here is the output of my last try of launching one of each containers:
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Loading configuration files...]
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Video Dir: /opt/selenoid/video]
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Your Docker API version is 1.39]
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Timezone: UTC]
selenoid_1 | 2019/11/14 12:44:14 [-] [INIT] [Listening on :4444]
selenoid-ui_1 | 2019/11/14 12:44:15 [INIT] [Listening on :8080]
selenoid-ui_1 | 2019/11/14 12:44:18 Client added. 1 registered clients
selenoid-ui_1 | 2019/11/14 12:44:27 Client added. 2 registered clients
selenoid_1 | 2019/11/14 12:44:29 [-] [NEW_REQUEST] [unknown] [192.168.38.49]
selenoid_1 | 2019/11/14 12:44:29 [-] [NEW_REQUEST_ACCEPTED] [unknown] [192.168.38.49]
selenoid_1 | 2019/11/14 12:44:29 [4] [LOCATING_SERVICE] [edge] [18.0]
selenoid_1 | 2019/11/14 12:44:29 [4] [USING_DOCKER] [edge] [18.0]
selenoid_1 | 2019/11/14 12:44:29 [4] [CREATING_CONTAINER] [docker.workflow.at/selenoid-edge:18]
selenoid_1 | 2019/11/14 12:44:30 [4] [STARTING_CONTAINER] [docker.workflow.at/selenoid-edge:18] [bff728c53f41e3433d9e1d631abf6ccb903c064b832853fdf07ef7fdb90fd0f4]
selenoid_1 | 2019/11/14 12:44:30 [4] [CONTAINER_STARTED] [docker.workflow.at/selenoid-edge:18] [bff728c53f41e3433d9e1d631abf6ccb903c064b832853fdf07ef7fdb90fd0f4] [0.79s]
selenoid_1 | 2019/11/14 12:44:33 [-] [NEW_REQUEST] [unknown] [192.168.38.49]
selenoid_1 | 2019/11/14 12:44:33 [-] [NEW_REQUEST_ACCEPTED] [unknown] [192.168.38.49]
selenoid_1 | 2019/11/14 12:44:33 [6] [LOCATING_SERVICE] [ie] [11.0]
selenoid_1 | 2019/11/14 12:44:33 [6] [USING_DOCKER] [ie] [11.0]
selenoid_1 | 2019/11/14 12:44:33 [6] [CREATING_CONTAINER] [docker.workflow.at/selenoid-ie:11]
selenoid_1 | 2019/11/14 12:44:34 [6] [STARTING_CONTAINER] [docker.workflow.at/selenoid-ie:11] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555]
selenoid_1 | 2019/11/14 12:44:35 [6] [CONTAINER_STARTED] [docker.workflow.at/selenoid-ie:11] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555] [0.99s]
selenoid_1 | 2019/11/14 12:46:13 [6] [SERVICE_STARTED] [docker.workflow.at/selenoid-ie:11] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555] [97.83s]
selenoid_1 | 2019/11/14 12:46:13 [6] [PROXY_TO] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555] [http://172.24.0.5:4444/wd/hub]
selenoid_1 | 2019/11/14 12:46:13 [6] [SESSION_ATTEMPTED] [http://172.24.0.5:4444/wd/hub] [1]
selenoid_1 | 2019/11/14 12:46:13 [6] [SESSION_FAILED] [http://172.24.0.5:4444/wd/hub] [405 Method Not Allowed]
selenoid_1 | 2019/11/14 12:46:13 [6] [REMOVING_CONTAINER] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555]
selenoid_1 | 2019/11/14 12:46:19 [6] [CONTAINER_REMOVED] [c399702d8b2eb7d3fad902ef50858fcd1af2fd823097b56c256335fc4b401555]
selenoid_1 | 2019/11/14 12:54:30 [4] [REMOVING_CONTAINER] [bff728c53f41e3433d9e1d631abf6ccb903c064b832853fdf07ef7fdb90fd0f4]
selenoid_1 | 2019/11/14 12:54:32 [4] [CONTAINER_REMOVED] [bff728c53f41e3433d9e1d631abf6ccb903c064b832853fdf07ef7fdb90fd0f4]
selenoid_1 | 2019/11/14 12:54:32 [4] [SERVICE_STARTUP_FAILED] [wait: http://172.24.0.4:4444/wd/hub does not respond in 10m0s]
Also here is my browsers.json i am using right now, i am not sure wether or not i have to put the full "/wd/hub"
to my windows images, but i have tried both ways and always had the same result
{
"chrome":{
"default":"78.0",
"versions":{
"78.0":{
"image":"selenoid/vnc:chrome_78.0",
"port":"4444",
"path":"/"
}
}
},
"firefox":{
"default":"70.0",
"versions":{
"70.0":{
"image":"selenoid/vnc:firefox_70.0",
"port":"4444",
"path":"/wd/hub"
}
}
},
"ie":{
"default":"11.0",
"versions":{
"11.0":{
"image":"docker.workflow.at/selenoid-ie:11",
"port":"4444",
"path":"/wd/hub"
}
}
},
"edge":{
"default":"18.0",
"versions":{
"18.0":{
"image":"docker.workflow.at/selenoid-edge:18",
"port":"4444",
"path":"/wd/hub"
}
}
}
}
Change your IE and Edge configurations in your browsers.js
as follow:
"internet explorer": {
"default": "11.0",
"versions": {
"11.0": {
"image": "docker.workflow.at/selenoid-ie:11",
"port": "4444",
"path": "/",
"privileged": true
}
}
},
"MicrosoftEdge": {
"default": "18.0",
"versions": {
"18.0": {
"image": "docker.workflow.at/selenoid-edge:18",
"port": "4444",
"path": "/",
"privileged": true
}
}
}
I think there is a chance that might solve the issue you are having. Also notice that you will not be able to manually
start the containers from the selenoid-ui
for IE and Edge until the following PR aerokube/selenoid-ui#253 or something like it get merged into selenoid-ui
.
After you change your browsers.js
and restart selenoid
to take the changes you can use curl
, postman
or ARC
to test your setup:
@emilorol in Selenoid containers are always running in privileged
mode.
@vania-pooh got it. I will update my personal browsers.js
, but it does not hurt to have it.
Hi everybody. Same Issue for me over docker in debian , with docker-compose.
version: '3'
services:
selenoid:
container_name: test-selenoid
image: aerokube/selenoid:1.9.3
networks:
- selenoid-net
command:
- -container-network=${PROJECT_NAME}_selenoid-net
ports:
- "4444:4444"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./browsers.json:/etc/selenoid/browsers.json:ro
- ./video:/opt/selenoid/video
selenoid-ui:
container_name: test-selenoid-ui
image: aerokube/selenoid-ui:1.9.0
networks:
- selenoid-net
command:
- "-selenoid-uri=http://selenoid:4444"
ports:
- "8080:8080"
networks:
selenoid-net:
Logs when force create session from selenoid-ui
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Loading configuration files...]
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Video Dir: /opt/selenoid/video]
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Your Docker API version is 1.40]
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Timezone: UTC]
test-selenoid | 2019/11/14 16:11:26 [-] [INIT] [Listening on :4444]
test-selenoid | 2019/11/14 16:11:51 [-] [NEW_REQUEST] [unknown] [172.24.0.1]
test-selenoid | 2019/11/14 16:11:51 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.24.0.1]
test-selenoid | 2019/11/14 16:11:51 [5] [LOCATING_SERVICE] [MicrosoftEdge] [18]
test-selenoid | 2019/11/14 16:11:51 [5] [USING_DOCKER] [MicrosoftEdge] [18]
test-selenoid | 2019/11/14 16:11:51 [5] [CREATING_CONTAINER] [windows/edge:18]
test-selenoid | 2019/11/14 16:11:52 [5] [STARTING_CONTAINER] [windows/edge:18] [e9f2b02357f8a14949c86056505819e8b2f8052ab7386d753ff11440be3bf26e]
test-selenoid | 2019/11/14 16:11:52 [5] [CONTAINER_STARTED] [windows/edge:18] [e9f2b02357f8a14949c86056505819e8b2f8052ab7386d753ff11440be3bf26e] [0.64s]
test-selenoid | 2019/11/14 16:12:22 [5] [REMOVING_CONTAINER] [e9f2b02357f8a14949c86056505819e8b2f8052ab7386d753ff11440be3bf26e]
test-selenoid | 2019/11/14 16:12:23 [5] [CONTAINER_REMOVED] [e9f2b02357f8a14949c86056505819e8b2f8052ab7386d753ff11440be3bf26e]
test-selenoid | 2019/11/14 16:12:23 [5] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.2:4444/ does not respond in 30s]
The same with any available browser
@toni-moreno usually container logs help to diagnose what's happening there.
Hi @vania-pooh I have been running ok with chrome but failing when creating a Edge session from UI.
The windows/edge container logs has these logs (the same logs when executing $ docker run -it --rm --privileged -p 4444:4444 -p 5900:5900 windows/edge:18
)
Waiting xvfb...
--- x11vnc loop: 1 ---
--- x11vnc loop: waiting for: 34
PORT=5900
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: guest updated active QH
qemu-system-x86_64: warning: guest updated active QH
The selenoid these
2019/11/14 17:16:04 [-] [NEW_REQUEST] [unknown] [172.17.0.1]
2019/11/14 17:16:04 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.1]
2019/11/14 17:16:04 [61] [LOCATING_SERVICE] [MicrosoftEdge] [18]
2019/11/14 17:16:04 [61] [USING_DOCKER] [MicrosoftEdge] [18]
2019/11/14 17:16:04 [61] [CREATING_CONTAINER] [windows/edge:18]
2019/11/14 17:16:04 [61] [STARTING_CONTAINER] [windows/edge:18] [e3d557c7948da748c68d41ce06dd3d31dca4b5e978e924f7613e31b0e1d06b7f]
2019/11/14 17:16:04 [61] [CONTAINER_STARTED] [windows/edge:18] [e3d557c7948da748c68d41ce06dd3d31dca4b5e978e924f7613e31b0e1d06b7f] [0.55s]
2019/11/14 17:16:34 [61] [REMOVING_CONTAINER] [e3d557c7948da748c68d41ce06dd3d31dca4b5e978e924f7613e31b0e1d06b7f]
2019/11/14 17:16:35 [61] [CONTAINER_REMOVED] [e3d557c7948da748c68d41ce06dd3d31dca4b5e978e924f7613e31b0e1d06b7f]
2019/11/14 17:16:35 [61] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.4:4444/ does not respond in 30s]
There is any way to test image without selenoid?
@toni-moreno certainly, just run it as follows:
$ docker run -p 4444:4444 -p 5900:5900 --privileged windows/edge:18
Then you should be able to access VNC on port VNC (password by default is selenoid
) or run your Selenium tests against: http://localhost:4444/
@toni-moreno the UI will fail to start containers for IE and Edge that is why I worked in the PR aerokube/selenoid-ui#253 . The reason why is because the code that it use to make the call from the UI uses non-W3C capability names and Edge has a problem with this. This mean that while the container will start and even the VM inside the container start, you might not be able to run a test or even open the browser.
@vania-pooh When I run the image I can connect to the VNC and windows machine is ok, and MicrosoftWebDriver.exe daemon running, but I can not launch navigation from outside.
I'm new in the selenium world and its sure there is lots of things I should learn. how can I test the MicrosfoftWebDriver.exe ? There is any kind of client to connect direct to the http://localhost:4444 and lauch a Edge browser with www.google.com ( by example) without need to have a selenium grid or selenoid in the middle?
@emilorol thank you for your great work I will test when merged and image updated. But I'm afraid about my windows10 with edge image has not been correctly configured , so I would like to test image withouth selenoid or grid in the middle. Do you know any way to do that?
@toni-moreno you can use just the same test because communication protocol remains the same.
@toni-moreno The way i tested my windows-images was by simply starting a RemoteWebdriver with the Ip of my container host and the right container's port
That was the code i was using to test (java)
InternetExplorerOptions caps = new InternetExplorerOptions();
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://IP:PORT/"), caps);
driver.quit();
Out of curiosity, does anyone know if it makes a difference if i use 64 bit windows version for my image? Because i just realized that i am using a 64 bit version altough the guide mentions a 32 bit version.
@NavySeal5 the only difference is total amount of memory Windows can allocate. I think you should be aware that 32 bit operating systems can work with limited (~4Gb) amounts of memory.
@vania-pooh Yes i am aware of that, but i was thinking that maybe this virtio network driver might be doing something different on the 32 bit version as my knowledge of networking is rather limited. But i guess my last hope is now this PR by @emilorol
Hi @NavySeal5 , when trying to do the test with this code
package newproject;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.edge.EdgeOptions;
import java.net.MalformedURLException;
public class PG2 {
public static void main(String[] args) {
EdgeOptions caps = new EdgeOptions();
URL url;
try{
url = new URL("http://localhost:4444/");
RemoteWebDriver driver = new RemoteWebDriver(url , caps);
String baseUrl = "http://www.facebook.com";
String tagName = "";
driver.get(baseUrl);
tagName = driver.findElement(By.id("email")).getTagName();
System.out.println(tagName);
driver.close();
System.exit(0);
//more code goes here
}catch(MalformedURLException ex){
//do exception handling here
System.out.println("The url is not well formed: ");
}
}
}
Nothing happens in my windows image ( have not seen nothing in my vnc viewer), and this exception happens.
vant@laptop:~/$ java -cp selenium-server-standalone-3.141.59.jar newproject.java
Exception in thread "main" 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:25:53'
System info: host: 'laptop', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-32-generic', java.version: '11.0.4'
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 newproject.PG2.main(newproject.java:16)
Caused by: java.io.IOException: unexpected end of stream on Connection{localhost:4444, proxy=DIRECT hostAddress=localhost/127.0.0.1:4444 cipherSuite=none protocol=http/1.1}
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:208)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at org.openqa.selenium.remote.internal.OkHttpClient$Factory$1.lambda$createClient$1(OkHttpClient.java:152)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
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.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at newproject.PG2.main(newproject.java:16)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:404)
at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:179)
at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:119)
Caused by: java.io.EOFException: \n not found: limit=0 content=…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:237)
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:215)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
... 34 more
But the port is opened an listening by docker
vant@laptop:~/$ sudo lsof -Pni :4444
[sudo] contraseña para vant:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 26316 root 4u IPv6 21356352 0t0 TCP *:4444 (LISTEN)
vant@labtop:~/$ nc -vz localhost 4444
Connection to localhost 4444 port [tcp/*] succeeded!
vant@laptop:~/$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49cea3d1d025 windows/edge:18 "/entrypoint.sh" 2 hours ago Up 2 hours 0.0.0.0:4444->4444/tcp, 0.0.0.0:5900->5900/tcp goofy_spence
How can I debug the connection from the MicrosoftWebDriver side?
@toni-moreno and to anyone else trying to test the setup. I was in the same boat no that long ago and I wanted to be able to test my windows image without having to break out a programming language or a testing framework.
To test your docker container locally, right after to finish setting it up with the windows VM you can follow the steps here:
https://github.com/aerokube/windows-images/issues/21
To test your windows vm container inside Selenoid
you can follow the same steps listed on the threat before, but with the URL of your Selenoid
server:
Change: http://127.0.0.1:4442/
for http://{YOUR-SELENOID-URL-OR-IP}:4444/wd/hub/
Also, I have never personally find use to the manual start of the session other than to confirm the container work and that I can see the browser thru the VNC.
Hi @emilorol thank you for this great guide.
I've tested as you show me and it seems my image has something wrong
vant@laptop:~/$ curl -X POST http://127.0.0.1:4442/session -d '{"capabilities": {"browserName": "MicrosoftEdge", "platform": "win10"}}'
curl: (52) Empty reply from server
vant@laptop:~/i$ nc -vz localhost 4442
Connection to localhost 4442 port [tcp/*] succeeded!
What should I check inside my container or my vm inside the container to diagnose which the problem
@toni-moreno you are using the local version of the test and that expect the windows VM container running first with the following command:
docker run -it -d --rm --privileged -p 4442:4444 -p 5902:5900 windows/edge:18
If you didn't and you have it running like the one you mention earlier change the port to 4444 and run the command like this:
curl -X POST http://127.0.0.1:4444/session -d '{"capabilities": {"browserName": "MicrosoftEdge", "platform": "win10"}}'
Hi again @emilorol I've changed the port just to make copy&paste , from your guide.
vant@laptop:~/$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f5dd45bd90c0 windows/edge:18 "/entrypoint.sh" 45 minutes ago Up 45 minutes 0.0.0.0:5900->5900/tcp, 0.0.0.0:4442->4444/tcp cool_mccarthy
but it is not working as expected....
can you run the following:
docker logs -f f5dd45bd90c0
Hi @emilorol , I've been playing with windows config and finally I got the session when I stopped windows firewall !!!
vant@laptop:~/$ curl -X POST http://127.0.0.1:4442/session -d '{"capabilities": {"browserName": "MicrosoftEdge", "platform": "win10"}}'
{"value":{"sessionId":"AECF266A-2581-450A-B15B-1EF53D3FD5B8","capabilities":{"acceptInsecureCerts":false,"browserName":"MicrosoftEdge","browserVersion":"44.18362.449.0","pageLoadStrategy":"normal","platformName":"windows","setWindowRect":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"proxy":{}}}}
vant@laptop:~/$ curl -X POST 'http://127.0.0.1:4442/session/AECF266A-2581-450A-B15B-1EF53D3FD5B8/url' -d '{"url":"https://www.google.com"}'
{"value":null}
The windows firewalls should be turned off for all network segments ( I had on on public network)
I've not tested yet with selenoid because I need to rebuild the windows image without firewall, I give you feedback ASAP
Thank you for your patience
For windows instead of completely disabling the firewall, I added an incoming firewall rule to port 4444/TCP. Otherwise windows will keep popping up warning and alert messages about the system security if the firewall is off in all zones.
To add an incoming rule open the cmd
prompt with as admin
and run the following command:
netsh advfirewall firewall add rule name="Open web driver Port 4444" dir=in action=allow protocol=TCP localport=4444
Note 1: windows image take a lot of storage space compare to other images, so what I did was when I created the snapshot I left the both prompts open listening on different ports and I added two rules instead of one.
Note 2: for Internet Explorer remember to disable the "Protected Mode"
in all of the security zones. Very important, I forgot this and I had to rebuild again.
Note 3: Heads up the clock stay behind when running from snapshot and websites using SSL might complain if their SSL was issue after the time/date of the machine.
Hi @emilorol ,thank you very much for this good tips.
I have a question about requirements from the underlying infrastructure. What exactly needs a Qemu base container from the underlying platform? Just only docker? Or docker on top of bare-metal? or could be any kind of virtualized (VirtualBox,VMware, Kvm) host?
Thank you in advance!
Qemu is just the virtual machine, no different to VMware or Vbox. By enabling the nested virtualization mode in the host machine all docker containers can also host VMs on them. Keep in mind that docker while it looks like a VM it is really not a VM. If you have a VM or a bare metal server that support nested virtualization then you can install selenoid or docker that run containers with VM inside of them.
thank you very much again @emilorol !!
I've been testing ie/edge images sending selenium data direct over port 4444 ( waiting for selenoid fix) and we found that on ie sendkeys is really slow as described here (https://intellipaat.com/community/6023/selenium-webdriver-typing-very-slow-in-text-field-on-ie-browser) Did you know about this issue?.
Perhaps could be interesting make reference on this good guide to make windows images.
You're welcome @toni-moreno
I haven't experienced the issue with slow sending of keys on IE, but it is one of those thing I am not surprised about. I can tell on my own experience that switching testing frameworks made a difference at one point. Specifically when I switch from the regular selenium java to the javascript protractor, maybe it is the way to handle the wait time or promises, but did see an improvement.
@toni-moreno I have had this issue aswell when i was using the 3.150 IEDriverServer When i switched back to the 3.141.59 it seemed to not occur again
@NavySeal5 @emilorol I switched to the 32b version and the senkeys issue has been resolved for me
Hi @vania-pooh, I have the following issue, When I try to run my selenium test.
"Running TestSuite tests-winners-net | [ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 35.446 s <<< FAILURE! - in TestSuite tests-winners-net | [ERROR] setup(SampleTest) Time elapsed: 35.26 s <<< FAILURE! tests-winners-net | org.openqa.selenium.WebDriverException: tests-winners-net | wait: http://172.17.0.2:4444/ does not respond in 30s (WARNING: The server did not provide any stacktrace information) tests-winners-net | Command duration or timeout: 32.71 seconds tests-winners-net | Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' tests-winners-net | System info: host: '0fbd71478324', ip: '192.168.224.4', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-56-generic', java.version: '15.0.1' tests-winners-net | Driver info: driver.version: RemoteWebDriver "
This is my browsers.json
{ "chrome": { "default": "85.0", "versions": { "85.0": { "image": "selenoid/vnc:chrome_85.0", "port": "4444", "path": "/wd/hub", "tmpfs": { "/tmp": "size=512m" }, "shmSize": 536870912 } } } }
public static WebDriver createWebDriver() throws MalformedURLException { final WebDriver driver;
// Run on Selenoid
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("browserVersion", "85.0");
capabilities.setCapability("selenoid:options", Map.<String, Object>of(
"enableVNC", true,
"enableVideo", true
));
// System.setProperty("webdriver.chrome.driver", "src/test/resources/drivers/chromedriver"); driver = new RemoteWebDriver( new URL("http://localhost:4444/wd/hub/"), capabilities );
return driver;
}
}
services:
selenoid:
image: "aerokube/selenoid:latest-release"
container_name: selenoid
# network_mode: bridge
ports:
- "4444:4444"
environment:
- OVERRIDE_VIDEO_OUTPUT_DIR=./selenoid/config/video
volumes:
- ./selenoid/config:/etc/selenoid
- ./selenoid/config/video:/opt/selenoid/video
- ./selenoid/config/logs:/opt/selenoid/logs
- /var/run/docker.sock:/var/run/docker.sock
command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
selenoid-ui:
container_name: selenoid-ui
image: "aerokube/selenoid-ui"
# network_mode: bridge
# links:
# - selenoid
ports:
- "8080:8080"
command: [ "--selenoid-uri", "http://selenoid:4444" ]
tests-winners-net:
build: ./
# network_mode: bridge
container_name: tests-winners-net
# network_mode: host
volumes:
- ./.m2:/root/.m2
command: ["mvn", "-f", "/home/app/pom.xml", "test"]
@vania-pooh can you help me?
@Artashes1996 you did not set -container-network
flag in Docker compose.
@vania-pooh
I am still getting the same issue for image: "selenoid/chrome"
Error : selenoid_1 | 2021/07/15 14:51:11 [4] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.2:4444/wd/hub does not respond in 2m0s]
My docker-compose.yml selenoid: command: [ "-conf" , "/etc/selenoid/browsers.json", "-video-output-dir", "/etc/selenoid/video","-container-network","default","-service-startup-timeout", "2m"]
I have added "-service-startup-timeout", "2m" What else should I do ?
@DebashishSamanta check whether manual run works.
@vania-pooh It would be great if you could kindly get me Manual run ( CLI ) code ?
@DebashishSamanta it's all documented here.
$ docker run -it --rm --privileged -p 4444:4444 -p 5900:5900 windows/edge:18 # For Microsoft Edge
$ docker run -it --rm --privileged -p 4444:4444 -p 5900:5900 windows/ie:11 # For Internet Explorer
Hi,
I'm having the same issue also with my current setup in Ubuntu 22.04 related to does not respond is 30s.
Here's my config so far.
docker-compose.yml
version: '3.7' services: selenoid: image: aerokube/selenoid:latest-release network_mode: host container_name: selenoid privileged: true environment:
command: ["-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-limit", "10", "-timeout", "10m", "-mem", "1g", "-cpu", "1", "session-attempt-timeout", "3m", "-service-startup-timeout", "3m"] ports:
volumes:
browsers.json
{ "chrome": { "default": "72.0", "verbose": "true", "versions": { "91.0": { "image": "selenoid/chrome:91.0", "limits": { "memory": "1024", "cpu": "1", "limit": "10" }, "path": "/", "port": "4444", "privileged": "true" }, "108.0": { "image": "selenoid/chrome:108.0", "limits": { "memory": "2048", "cpu": "2", "limit": "20" }, "path": "/", "port": "4444", "privileged": "true", "verbose": "true" } } }, "firefox": { "default": "66.0", "versions": { "65.0": { "image": "selenoid/firefox:65.0" }, "66.0": { "image": "selenoid/firefox:66.0", "limits": { "memory": "2048", "cpu": "2", "limit": "20" }, "path": "/", "port": "4444", "privileged": "true", "verbose": "true" } } } }
Here's my sample script using Robot Framework.
Settings Library SeleniumLibrary Library Collections Library OperatingSystem
Variables ${SELENOID_URL} http://localhost:8080/wd/hub ${BROWSER_NAME} chrome ${BROWSER_VERSION} 91.0 ${PLATFORM} LINUX ${SCREEN_RESOLUTION} 2560x1440x24 ${PAGE_LOAD_STRATEGY} eager ${SESSION_TIMEOUT} 2m
Test Cases Execute Tests in Selenoid [Documentation] Execute automation tests in Selenoid environment Execute Tests in Selenoid Environment
Keywords Execute Tests in Selenoid Environment [Documentation] Run various tests in Selenoid environment ${selenoid_caps}= Create Dictionary ... browserName=${BROWSER_NAME} ... version=${BROWSER_VERSION} ... platform=${PLATFORM} ... enableVideo=${True} ... enableVNC=${True} ... sessionTimeout=${SESSION_TIMEOUT} Open Browser remote_url=${SELENOID_URL} desired_capabilities=${selenoid_caps} Sleep 10 Maximize Browser Window Go To https://www.example.com Title Should Be Example Domain Go To https://www.robotframework.org Title Should Be Robot Framework Close Browser
Actually I'm able to manually create session via Selenoid UI
@edsherwin try to set --service-startup-timeout 2m --session-attempt-timeout 2m
to Selenoid flags.
@edsherwin try to set
--service-startup-timeout 2m --session-attempt-timeout 2m
to Selenoid flags.
@vania-pooh I've already set that config to my command in selenoid and still no luck.
command: ["-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-container-network", "selenoid", "-limit", "30", "-timeout", "15m", "-mem", "2g", "-cpu", "2", "session-attempt-timeout", "2m", "-service-startup-timeout", "2m"]
-- Execution is created but it's displayed in Session list in Selenoid UI
Logs SessionNotCreatedException: Message: wait: http://172.19.0.2: does not respond in 30s
@edsherwin something is wrong in your setup if Selenoid is still failing after 30 seconds, e.g. you have session-attempt-timeout
but should be -session-attempt-timeout
(with leading dash symbol).
@vania-pooh I already correct that one and the issue still persist.
@edsherwin did you manage to find a solution for this?
So i have built the windows-images according to the guide (which was very helpful) and played around with them for a big and have encountered one issue. When i try to launch these images with Selenoid, the container fails to start with the following message:
However when i launch the containers myself i can connect to them via vnc just fine and also tests against the Webdriver running inside work. So my only issue is the containers not seeming to work together with Selenoid.
I am using docker-compose to launch selenoid together with selenoid-ui, the docker-compose file:
I am doing all this on Ubuntu 18.04 running in a Hyper-V on Windows 10