-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Cannot run playwright tests on Selenium Grid. #18892
Comments
Which Chromium version are you using on your Selenium Grid? |
I can confirm this issue when using chrome node in docker or k8s Got almost same error message
Sample script that fails const { chromium } = require('playwright')
; (async () => {
const browser = await chromium.launch({headless: false})
try {
const page = await browser.newPage()
await page.goto('https://danube-web.shop/')
await page.click('#cart')
await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
await browser.close()
}
})() Chrome capabilities reported by Selenium Grid v4.6
|
mxschmitt Playwright only can run on Chrome and Edge on Selenium grid [Playwright can connect to Selenium Grid Hub that runs Selenium 4 to launch Google Chrome or Microsoft Edge browser, instead of running browser on the local machine. If you try without the channel param (in order to get Chromium or Firefox) you get an unsupported exception. |
@dimsamaras Any suggestion on how to debug this issue deeply to investigate what can go wrong? |
@alfeg, thanks for taking a look at it! I have installed Selenium Grid on Kubernetes using the templates found here: https://github.com/SeleniumHQ/docker-selenium/blob/trunk/charts/selenium-grid/README.md After that i had no issue taking the logs for the hub and browser pods. |
Okay, my bad. Take some time and completed run for different Selenium Grid version:
@mxschmitt can at this point I'm not sure should this bug belong to PW or to Selenium Grid itself. Steps I've done
Executed js script above #18892 (comment) Chrome pod (this pod has custom
This is hub pod
|
@dimsamaras Could you run your playwright script with |
Attaching |
I'm having a similar issue with the latests grid versions. In my scenario I'm connecting via CDP to an existing session .The only action working is navigate to a page ,after which we cannot do any other action. <<<<<<<<<<<<<<<<<<<<< Node: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
I'm also facing a similar issue with the latest grid versions. with the selenium grid its able to connect. It launches the browser and even navigates to the url. But after that it doesn't interact with the grid. grid log says - WARN [ProxyWebsocketsIntoGrid$ForwardingListener.onError] - Error proxying websocket command |
Playwright does indeed use proxying websocket functionality. We'll take a look, but for now I'd suggest to stay on 4.5.0 since that seems to work. |
Just to keep up to date |
I have encountered a similar problem and any version after 4.5.0 including the latest at the moment 4.7.2 does not allow to interact with the page. |
With 4.7.2 Selenium, we are unable to perform any action such as click/type etc.. Only Launch URL is working. Any update on this? |
I have the same exact issue with selenium grid versions mentioned above. |
@wodyjowski, @sridharreddysuram123, @Schtil, @alfeg, @sohambbh, |
Similar Issue with GRID 4.7.2com.microsoft.playwright.PlaywrightException: Error {
|
@dgozman any update on this? |
@dgozman |
@dimsamaras thankfully issue can be resolved by only downgrading the selenium-hub container to |
Selenium guys have two issues for this: |
@wodyjowski How do you downgrade the selenium-hub container to 4.5.0? |
You can do it by using separate images for hub and nodes (not the "standalone" version).
|
However, I think it is important to say that this is not a solution to the problem. |
@wodyjowski |
@CkumarGitHub you're not setting up the grid properly. |
We are unfortunately using a separate grid for playwright only. The reason is in 4.5.0 version - selenium grid has some hard waits which was fixed in later version. So we cant go back and have the slow execution for all other types of test. |
Also as per above comment from a selenium project core member in SeleniumHQ/docker-selenium#1729 - Selenium grid doesn't support playwright. But playwright says in its webpage that it supports selenium grid. So I think the responsibility is more with playwright project now. Please let us know your thoughts on this bug. If there is no plan kindly let us know , then we will start migrating from playwright to selenium. |
I'm not a Microsoft employee (yet) so I can't speak for them but as you can read in SeleniumHQ/selenium#11408 the issue occures even in example written in GO and some random Chrome DevTools Protocol implementation. |
I found the same issue reported here. And I could have it working with Selenium Grid versions prior to I've been working with Selenium in the past years and had difficulty upgrading to a stable version of This blog post explains: It seems the main issue reported here is related to this change and how web sockets communicate internally and with the library in Selenium Grid.
My guess is that Playwright would have to be internally changed to communicate with Selenium Grid, following the upgrade from |
@evertones Thank you for your participation in solving this problem. Tell me, were you able to reproduce the problem using Selenium directly, without Playwright? I'm asking because it seems that the SeleniumGrid developers are more talkative in this regard (at least no Microsoft developers have been here yet :( (from November 2022) ) |
@Schtil : The original problem solved by moving from async-http-client to Java HTTP Library is the following: It was reported in May/2021 and solved only in November/2022 after a lot of discussion and tests. I could test different versions of Selenium Grid with Playwright and see that:
It's possible to see in the release notes of 4.5.2-20221021 that it started to use the new HTTP Client in all docker images of Selenium, as seen in this commit:
By saying that, I truly believe the problem is related to the changes in the HTTP Client, however, as @diemol (core Selenium member) said in a comment mentioned here, it should not be a problem that Selenium team must solve, but Playwright team. |
@Schtil: I could make this work with the suggestion from EndPositive in this comment. He suggests a workaround to increase the WebSocket buffer size by adding the following:
I created a
I believe that if Playwright needs a bigger WebSocket than supported by default in Selenium, the documentation should be updated and it would be Playwright's responsibility to indicate the custom config to make it work. |
Increase ws size and provide SE_NODE_GRID_URL microsoft/playwright#18892
Team, |
Also leaving this comment, we are open for collaboration folks. |
@diemol here you go: https://github.com/wodyjowski/SeleniumIssue |
I'll reopen the Selenium issue and have a look. What is the plan you folks have when Selenium drops CDP support and only relies on BiDi? Have you checked it already? |
@diemol I see that you've made a fix and closed your issue - when will it be available? Will Selenium Driver suddenly drop HTTP and switch do BiDi? |
It won't be sudden, there will be enough deprecation notice before moving to BiDi completely. |
Increase ws size and provide SE_NODE_GRID_URL microsoft/playwright#18892
I have created a simple .net 6 console app to check whether it is possible to use Selenium Grid instead of Moon in order to have a svc managing the Browsers.
this is my dummy code Program.cs:
I have set the necessary env variables
SELENIUM_REMOTE_URL
---> THE PROBLEM <---
The screenshot for full page times out.
If i remove the
FullPage = true
the screenshot succeeds.Similarly, if i do a
page.clickAsync()
action it times out,page.CloseAsync()
works.navigating to different pages with
page.GoToAsync
calls again works without issue.It looks like some actions just do not work.
I am attaching the errors i get from the hub and the chrome pod.
I have tried both with chrome and edge.
I have also tried different versions of playwright 1.17.3 to 1.27.2 and changed the browser versions on Selenium Grid deployment without any success :(
I also created another app that uses Selenium.Webdriver and everything works fine:
Thank you in advance!
Dimitris
The text was updated successfully, but these errors were encountered: