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

Selenium GRID in distributed mode vs Playwright #22488

Closed
LubikR opened this issue Apr 19, 2023 · 4 comments
Closed

Selenium GRID in distributed mode vs Playwright #22488

LubikR opened this issue Apr 19, 2023 · 4 comments

Comments

@LubikR
Copy link

LubikR commented Apr 19, 2023

I have deployed Selenium GRID in distributed mode about two years ago. Actually on version 4.8.3. Selenium server runs on swarm manager node on IP 10.42.132.147. About 40 chrome browsers, 10 firefox browsers runs on worker nodes. I have created "Selenium network" on overlay driver, so Selenium server sees all selenium nodes on workers trhrough this network. Workres have internal IPs from range192.168.2.0/24.

If I run test from local I got:

Error: browserType.launch: WebSocket error: connect ECONNREFUSED 192.168.2.4:4444
=========================== logs ===========================
connecting to http://10.42.132.147:14444/
connected to sessionId=c6d499f68bad442b5c3a7e7b86a3732b
using selenium v4
retrieved endpoint ws://192.168.2.4:4444/session/c6d499f68bad442b5c3a7e7b86a3732b/se/cdp for sessionId=c6d499f68bad442b5c3a7e7b86a3732b
ws://192.168.2.4:4444/session/c6d499f68bad442b5c3a7e7b86a3732b/se/cdp
ws://192.168.2.4:4444/session/c6d499f68bad442b5c3a7e7b86a3732b/se/cdp error connect ECONNREFUSED 192.168.2.4:4444
ws://192.168.2.4:4444/session/c6d499f68bad442b5c3a7e7b86a3732b/se/cdp connect ECONNREFUSED 192.168.2.4:4444
ws://192.168.2.4:4444/session/c6d499f68bad442b5c3a7e7b86a3732b/se/cdp code=1006 reason=
disconnecting from sessionId=c6d499f68bad442b5c3a7e7b86a3732b
disconnected from sessionId=c6d499f68bad442b5c3a7e7b86a3732b

It seems that playwright got internal IP from selenium sever and try to connect to browser ip 192.168.2.4, but this address is not reachable, it is internal "docker" ip.

We have about 200 tests in Java vs Grid and Java always calls server IP. The question is why playwright calls internal IP (according to my understanding of the log)

@dgozman
Copy link
Contributor

dgozman commented Apr 19, 2023

Perhaps you need to configure Selenium so that it advertises nodes with the right IP. We recommend setting SE_NODE_GRID_URL to make sure the right address is used. Take a look at #11692 for discussion, and also at this guide.

@LubikR
Copy link
Author

LubikR commented Apr 20, 2023

Thanks for advice. Yes, if I set the SE_NODE_GRID_URL variable correctly, the error disappears, but the test ends with the open "empty" browser and nothing else happens, i.e. behaviour is the same as described in #11692

@dgozman
Copy link
Contributor

dgozman commented Apr 20, 2023

@LubikR Perhaps you are hitting #18892 now, take a look at the discussion there. This comment seems to have a workaround for now. Let me know if that helps.

@LubikR
Copy link
Author

LubikR commented Apr 21, 2023

Set JAVA_OPTS=-Djdk.httpclient.websocket.intermediateBufferSize=3000000 helped and the playwright tests are now working in GRID. Thank you for your help! At first glance, I am very surprised by the speed of execution of our tests in GRID. I expected a slowdown in the test execution, but it seems to be very small. We will do more tests. This issue should be closed.

@dgozman dgozman closed this as completed Apr 21, 2023
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