当前位置:网站首页>Browsercontext class of puppeter

Browsercontext class of puppeter

2022-06-12 16:13:00 crayon-shin-chan

file :puppeteer/api.md at main · puppeteer/puppeteer · GitHub

1. brief introduction

BrowserContexts Provides a method of operating multiple independent browser sessions .

When you start the browser , Use a default BrowserContext.

browser.newPage() Method to create a page in the default browser context .

If the page opens another page , adopt window.open, The pop-up window will belong to the browser context of the parent page .

Puppeteer Allows you to create an invisible browser context

The stealth browser context does not write any browsing data to disk .

2. Create context

createIncognitoBrowserContext Method to create an invisible browser context

const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();
await page.goto('https://example.com');
await context.close();

3.browser

Get the browser to which the context belongs

browser(): Browser;

4.pag

原网站

版权声明
本文为[crayon-shin-chan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121603282428.html