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

[Question] How to disable bringing page to front during launching. #4822

Closed
shirshak55 opened this issue Dec 25, 2020 · 9 comments
Closed

[Question] How to disable bringing page to front during launching. #4822

shirshak55 opened this issue Dec 25, 2020 · 9 comments

Comments

@shirshak55
Copy link

Its Headful mode.

Currently I am doing web chat tests where I would like to test multiple context.

If I spawn new context it brings that page to front loosing the focus.

let browser = await firefox.launch()

// Every 1 minute open new context and open page just to test if chat shows history or not.
while(true) {
  let context = await browser.newContext()
  let page = await context.newPage();
  
  // delay code is there not shown here.

}

The issue is that newContext spawns a new window which has focus or something is in page that is calling page.bringToFront() when its launched.

Questions:

  1. I would like to disable these behavior. If possible please let me know.
  2. Is there anyway to minimize the context window after launch. If I need to bring page to front I think i can call page.bringToFront() at the moment.

Its not a new issue I think and there are no answers available afaik.
puppeteer/puppeteer#5484
https://stackoverflow.com/questions/53501564/hide-browser-in-puppeteer

@creage
Copy link

creage commented Dec 28, 2020

Well, we have a plenty of chat testing, and we have no issues running multiple browser instances. We have tests up to 4 users chatting at the same time, with no issues.

What exact problem do you have?

@shirshak55
Copy link
Author

shirshak55 commented Dec 28, 2020

@creage the issue is focus stealing. For 2-3 edge case we tests manually and we spawn like new window after 5 sec interval. When testing manually we are typing and the browser come in front of face which is abit annoying.

@pavelfeldman
Copy link
Member

Playwright emulates all pages as focused, what exactly do you mean by focus stealing?

@pavelfeldman
Copy link
Member

Ah, you mean your scenarios are hybrid and the focus is stolen from the person performing the manual steps? Can I ask why you are typing manually?

@shirshak55
Copy link
Author

@pavelfeldman Yea its like when we are doing some work on one window and if another window is spawned focus is stolen from the person doing manual steps. Sometime we need to do it for accessibility check in headful mode and is mostly from devops team.

@pavelfeldman
Copy link
Member

I don't think we can do anything about it (focusing), but we could try helping automating those a11y checks!

@shirshak55
Copy link
Author

alright then I shall close this issue :) I also think its probably firefox or chrome issue

Thanks.

@bstro
Copy link

bstro commented Nov 17, 2021

I also experience this; its pretty annoying to have jest running with --watch while developing and have focus stolen away constantly by the playwright. It seems like it has to be possible to have an option to instruct playwright to open Chromium in the background, rather than foreground.

@ThatGuySam
Copy link

There's a command I figured out on macOS to start iOS Simulator in the background which reliably disables it from taking focus.

open -g -a Simulator

However, I'm unsure how to launch Playwright's Chromium with this option

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

5 participants