What happened?
I have a selenium grid mounted over different VMs where I can run tests successfully. I use WebdriverIO to run it, and everything works fine.
These are the se capabilities returned:
[0-0] 'se:bidiEnabled': false,
[0-0] 'se:cdp': 'ws://VIP-MACHINE-1:4444/session/09a56f82da1526f0e8fc61d1e17d020c/se/cdp',
[0-0] 'se:cdpVersion': '111.0.5563.110',
[0-0] 'se:vnc': 'ws://VIP-MACHINE-1:4444/session/09a56f82da1526f0e8fc61d1e17d020c/se/vnc',
[0-0] 'se:vncEnabled': true,
[0-0] 'se:vncLocalAddress': 'ws://172.17.0.2:7900',
(I start my chrome container with the --grid-url http://VIP-MACHINE-1:4444 flag)
I'm trying to implement now a Dynamic Selenium Grid 4 over different VMs, and I was able to create it successfully, however the tests can't run because they're trying to connect to a faulty IP.
With this Dynamic approach, I get the following se capabilities returned:
[0-0] 'se:bidiEnabled': false,
[0-0] 'se:cdp': 'ws://VIP-MACHINE-1:4444/session/be2c51a8a4be7f22cc82d13525aac4d8/se/cdp',
[0-0] 'se:cdpVersion': '111.0.5563.146',
[0-0] 'se:forwardCdp': 'ws://172.17.0.6:6211/session/be2c51a8a4be7f22cc82d13525aac4d8/se/fwd',
[0-0] 'se:vnc': 'ws://VIP-MACHINE-1:4444/session/be2c51a8a4be7f22cc82d13525aac4d8/se/vnc',
[0-0] 'se:vncEnabled': true,
[0-0] 'se:vncLocalAddress': 'ws://172.17.0.6:7900',
From the code used on WDIO https://github.com/webdriverio/webdriverio/blob/main/packages/webdriverio/src/commands/browser/getPuppeteer.ts#L60 I see that they're looking at the cdp and trying to connect to it however, I think that the se:forwardCdp endpoint is somewhat overriding it (which makes sense because the session will not be present on the node-docker container, but on the new container created by it). I've this log on my container:
14:19:33.088 INFO [ProxyNodeWebsockets.apply] - Found endpoint where CDP connection needs to be forwarded
14:19:33.090 INFO [ProxyNodeWebsockets.createWsEndPoint] - Establishing connection to ws://172.17.0.6:6211/session/be2c51a8a4be7f22cc82d13525aac4d8/se/fwd
In sum, this is problematic because we're not able to connect to 172.17.0.6 because that's the internal container IP. I found this comment by @diemol #9202 (comment) where maybe you were fixing the same problem? Maybe we need a flag for the forwardCdp param? (ideally not because I think that the address will be the same as the se:cdp ?
How can we reproduce the issue?
Started the Hub on Box 1:
docker run -p 4442-4444:4442-4444 selenium/hub:4.8.3-20230404
Started the Node on Box 2:
docker run --net=host -p 5555:5555 \
-e SE_EVENT_BUS_HOST=<IP-VM1> \
-e SE_NODE_GRID_URL=http://<IP-VM1>:4444 \
-e SE_NODE_HOST=<IP-VM2> \
-e SE_NODE_PORT=5555 \
-e START_XVFB=false \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_OVERRIDE_MAX_SESSIONS=true \
-v ${PWD}/config.toml:/opt/bin/config.toml \
-v ${PWD}/assets:/opt/selenium/assets \
-v /var/run/docker.sock:/var/run/docker.sock \
selenium/node-docker:4.8.3-20230404
I ran a simple test in WDIO:
describe("webdriver.io page", () => {
it("should have the right title", async () => {
const pageMock = await browser.mock("https://google.com/");
pageMock.respond("https://webdriver.io");
await browser.url("https://google.com");
console.log(await browser.getTitle()); // returns "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js"
});
});
Basically something that reaches this point: https://github.com/webdriverio/webdriverio/blob/main/packages/webdriverio/src/commands/browser/getPuppeteer.ts#L60 that makes puppeteer connect to the grid websocket.
### Relevant log output
```shell
NA
Operating System
CentOS 7
Selenium version
NA
What are the browser(s) and version(s) where you see this issue?
Node-Docker
What are the browser driver(s) and version(s) where you see this issue?
NA
Are you using Selenium Grid?
4.8.3-20230404
What happened?
I have a selenium grid mounted over different VMs where I can run tests successfully. I use WebdriverIO to run it, and everything works fine.
These are the
secapabilities returned:(I start my chrome container with the
--grid-url http://VIP-MACHINE-1:4444flag)I'm trying to implement now a Dynamic Selenium Grid 4 over different VMs, and I was able to create it successfully, however the tests can't run because they're trying to connect to a faulty IP.
With this Dynamic approach, I get the following
secapabilities returned:From the code used on WDIO https://github.com/webdriverio/webdriverio/blob/main/packages/webdriverio/src/commands/browser/getPuppeteer.ts#L60 I see that they're looking at the
cdpand trying to connect to it however, I think that these:forwardCdpendpoint is somewhat overriding it (which makes sense because the session will not be present on thenode-dockercontainer, but on the new container created by it). I've this log on my container:In sum, this is problematic because we're not able to connect to
172.17.0.6because that's the internal container IP. I found this comment by @diemol #9202 (comment) where maybe you were fixing the same problem? Maybe we need a flag for the forwardCdp param? (ideally not because I think that the address will be the same as these:cdp?How can we reproduce the issue?
Started the Node on Box 2:
I ran a simple test in WDIO:
Basically something that reaches this point: https://github.com/webdriverio/webdriverio/blob/main/packages/webdriverio/src/commands/browser/getPuppeteer.ts#L60 that makes puppeteer connect to the grid websocket.
Operating System
CentOS 7
Selenium version
NA
What are the browser(s) and version(s) where you see this issue?
Node-Docker
What are the browser driver(s) and version(s) where you see this issue?
NA
Are you using Selenium Grid?
4.8.3-20230404