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

Is there a way to not close the browser window when the test is done? #334

Open
daniel-abramov opened this issue Mar 3, 2023 · 2 comments

Comments

@daniel-abramov
Copy link

I'm using playwright-go in the following way. I create 10 contexts. Each context creates its page, performs a log-in operation in the app, and then joins chat rooms with fake audio and video devices that I've configured with Chromium flags. The app continues to run until I send a SIGTERM to it.

After some tests, I've noticed that the test clients that are being created in such a way do disappear shortly after being started (despite the test application with playwright running).

That was a bummer as I expected the Chromium instances to remain open until the app ended or the playwright, context, or page are closed.

I removed the headless flag to see what happens and noticed that the Chromium windows just get closed by the playwright for some unknown reason.

I tried to work with the persistent context to workaround it, but it did not change anything, unfortunately.

@marc136
Copy link

marc136 commented Mar 4, 2023

Hi @daniel-abramov, not sure if this is available in the go bindings, because I couldn't geht playwright to run.

But with node.js, I use the page pause API for this purpose.

It seems to exist in the go API as well:

Pause() error

@daniel-abramov
Copy link
Author

Thanks, @marc136. Yeah, I've tried Pause() and also different wait-functions, but unfortunately they did not have the intended effect. The Pause() paused the execution of the JavaScript (which I did not want as I needed the page to continue execution and reaction to the incoming events). And the wait functions did not seem to have any effect at all (Playwright kept closing windows if they were in a waiting state). I suppose it's either some sort of a bug or expected behavior that might have a simple solution that I'm just not aware of 🙂

I went for a workaround by rewriting it in Rust using rust-headless-chrome that relies upon Chrome DevTools Protocol, so its API surface is very similar to Playwright. Surprisingly, it does not exhibit the same issue and worked just fine for my use case.

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