-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[🐛 Bug]: se:forwardCdp is returning the internal docker IP which causes Dynamic distributed selenium grid to not work correctly #11910
Comments
@PinhoL, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Not sure what the issue is because the client should connect to the "public" given url and the |
Hello @diemol thanks a lot for the answer. From my understanding, Puppeteer needs an endpoint to connect to. Previously, when this #9202 was implemented, we had a connection of hub-node, and passing the --grid-url solved the issue. Now the grid is forwarding it to the new node with the internal IP of the container, right? Because on my side, what is happening is that Puppeteer is trying to connect to the URL passed by the Something like: this.puppeteer = await puppeteer.connect({browserWSEndpoint: "VIP-VM1"}) gives me on the
Which makes me believe that the connection to that websocket cannot be done because the puppetteer instance is not running on that docker container. A little bit similar to what I believe was happening here #9202 (comment) where the connection could not be made because the IP returned was the internal IP. If the grid automatically redirects the WS when the |
That is strange because when the Selenium bindings use CDP features over websockets things work normally, the client connects to the Grid URL and the internal forwarding does not affect things at all. I cannot say what Puppeteer is doing, so not sure what needs to be done. If you provide a way to reproduce it with Selenium, I'd be happy to look at it. Else, I'd be happy to review a PR that helps Puppeteer work properly with Grid. |
I've created a small example https://github.com/PinhoL/dynamic-grid to run a test against the dynamic grid to demonstrate this error. Just I don't have my grid setup public, so unfortunately I can't provide this endpoint, however these are the commands I used to spin up my grid: Hub:
Node:
And my
Some notes:
And in this instruction, which is native to the
|
This is an example of a log from the container that is spawned by the
|
I was able to reproduce the issue using Java Selenium and your test as well. For some reason that I do not completely understand, when the WebSocket was being closed, Chrome was responding with a -1 as statusCode. Seems incorrect on the browser side but 🤷 I've added code surrounding that situation and it is working now. This should be released in ~1 week. |
That's great @diemol thanks a lot! 🙇 |
Hey @diemol , hope you're well.. I've tested today with the newest version (4.9.1 hub/node) but the problem persists. When you did your tests, did you test with the |
The failure was present even without the |
Yes, without that parameter it works. It seems that if there's a mix up of networks (node-container is started on |
I can see it does not work when using |
I was making changes to the code to see if supporting I am sorry to say, but for now, I do not think we are going to support network |
Thanks for having to time to look into this @diemol ! I understand that this might be a big change and it's not easy to ship it. I'll keep my eyes on this and if eventually its released in the future, i'll be able to use it. Again, thanks for having the time to look into it |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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:(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: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 these:forwardCdp
endpoint is somewhat overriding it (which makes sense because the session will not be present on thenode-docker
container, 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.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 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
The text was updated successfully, but these errors were encountered: