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

[Feature] Ability to skip/or close the page opened by browser.launch #981

Closed
jperl opened this issue Feb 13, 2020 · 18 comments
Closed

[Feature] Ability to skip/or close the page opened by browser.launch #981

jperl opened this issue Feb 13, 2020 · 18 comments

Comments

@jperl
Copy link
Contributor

jperl commented Feb 13, 2020

Version: d367a2e (current master)

When running this script it opens two pages (and I think two contexts)

  • one after chromium.launch
  • the other after context.newPage
const { chromium, devices } = require("playwright");
const iPhone = devices["iPhone 6"];

(async () => {
  const browser = await chromium.launch({ headless: false });
  const context = await browser.newContext({
    viewport: iPhone.viewport,
    userAgent: iPhone.userAgent
  });
  const page = await context.newPage();
})();

I would like to close the page opened by chromium.launch, or skip opening it in the first place. Since it is confusing to have a blank page that is not in use (https://github.com/qawolf/qawolf/issues/395).

example-small

@pavelfeldman
Copy link
Member

Thanks for the report. We are going to get there, but it'll take some time. In order to implement it we need to introduce a new mode in all the browsers that does not open the default profile on browser startup.

@pavelfeldman
Copy link
Member

Should be fixed by now in Chromium and WebKit. Still has an extra tab in FF, but that is probably Ok for now.

@DavertMik
Copy link
Contributor

Yeah, extra tab is less annoying than extra window.
Anyway, when this fixes will be available, in 0.12?

@jperl
Copy link
Contributor Author

jperl commented Mar 4, 2020

@DavertMik It's merged so you can get it before the next release by installing playwright@next

@FrankLaterza
Copy link

Will this ever be implemented in FF?

@suchcodemuchwow
Copy link

This issue still exist in 1.17.1 @pavelfeldman

@himanshuG-92
Copy link

This issue still exists. As I am trying to run tests on default chrome browser with 1.22 Playwright version and it is opening two windows.(one is blank and another is loading my test site).
Please look into the issue. @pavelfeldman

@honzajde
Copy link

honzajde commented Aug 3, 2022

Still exists - two windows with Firefox.

@jiahaoyu6666
Copy link

If you don't add the configs in jest-playwright-config.js with this:

module.exports = {
    browsers: [ 'chromium', 'firefox' ],
    launchOptions: {
        headless: false,
    },
    contextOptions: {
        acceptDownloads: true,
    },
};

and only open the browser with chromium.launch or firefox.launch, then you won't have the extra browser window issue.
Other wise I still have that issue for both browser: chromium and firefox.

@zhaojc
Copy link

zhaojc commented Jan 9, 2023

Still exists - two windows with Chrome. 1.28.1

@opr
Copy link

opr commented Apr 14, 2023

I'm still seeing this with Chromium Version 112.0.5615.29 (Developer Build) (arm64) one window opens and stays blank, the other is behind it and runs my tests.

@Segvr
Copy link

Segvr commented Aug 11, 2023

I'm still seeing this with Chromium Version 112.0.5615.29 (Developer Build) (arm64) one window opens and stays blank, the other is behind it and runs my tests.

same problem with firefox, chromium

@aminaodzak
Copy link

It's weird this got closed, even issues still persists. Any thoughts? @pavelfeldman

@LazzyBird
Copy link

LazzyBird commented Oct 27, 2023

The issue still persists for all built-in browsers, one browser window is opened with the expected URL, and immediately the new one is blank and active so all tests are false-failed.

@poojakatte
Copy link

yes this issue still exists, m new to playwright, any solution?

@jasonribble
Copy link

I believe this issue is still around.

@roman-smolnyk
Copy link

roman-smolnyk commented Mar 22, 2024

In python I fix it like this:

browser = playwright.firefox.launch()
page = browser.pages[0]
# OR
page = browser.new_page()
browser.pages[0].close()

@erayyagiz
Copy link

I'm also facing this issue, additionally, when one suite execution is completed, another suite cannot go to the URL even though they can be running as a single properly.

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