question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Version: https://github.com/microsoft/playwright/commit/d367a2ed3a2d583e5e82d27ac1f53caddd8aa943 (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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
pavelfeldmancommented, Feb 27, 2020

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

3reactions
pavelfeldmancommented, Feb 13, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window.close() - Web APIs - MDN Web Docs - Mozilla
close () method closes the current window, or the window on which it was called. This method can only be called on windows...
Read more >
Scraping the web with Playwright | ScrapingBee
Playwright is a browser automation library for Node.js (similar ... This comes in handy when scraping data from several web pages at once....
Read more >
window.close and self.close do not close the window in Chrome
open () will the new window be able to close using code as I have mentioned above. This works perfectly for me :)...
Read more >
How To Scrape a Website Using Node.js and Puppeteer
Step 3 — Scraping Data from a Single Page. Before adding more functionality to your scraper application, open your preferred web browser and ......
Read more >
puppeteer.Page.close JavaScript and Node.js code examples
Scrolls the page and gets the page content using PhantomJS async function getPageData(pageUrl, shouldScrollPage) { const browser = await puppeteer.launch(); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found