--- sidebar_label: Page --- # Page class Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in the browser. :::note One Browser instance might have multiple Page instances. ::: #### Signature: ```typescript export declare abstract class Page extends EventEmitter ``` **Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[PageEvents](./puppeteer.pageevents.md)> ## Remarks The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Page` class. ## Example 1 This example creates a page, navigates it to a URL, and then saves a screenshot: ```ts import puppeteer from 'puppeteer'; (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://example.com'); await page.screenshot({path: 'screenshot.png'}); await browser.close(); })(); ``` The Page class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [PageEvent](./puppeteer.pageevent.md) enum. ## Example 2 This example logs a message for a single page `load` event: ```ts page.once('load', () => console.log('Page loaded!')); ``` To unsubscribe from events use the [EventEmitter.off()](./puppeteer.eventemitter.off.md) method: ```ts function logRequest(interceptedRequest) { console.log('A request was made:', interceptedRequest.url()); } page.on('request', logRequest); // Sometime later... page.off('request', logRequest); ``` ## Properties
Property Modifiers Type Description
accessibility `readonly` [Accessibility](./puppeteer.accessibility.md) The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access).
coverage `readonly` [Coverage](./puppeteer.coverage.md) The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page.
keyboard `readonly` [Keyboard](./puppeteer.keyboard.md) Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.
mouse `readonly` [Mouse](./puppeteer.mouse.md) The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
touchscreen `readonly` [Touchscreen](./puppeteer.touchscreen.md) The Touchscreen class exposes touchscreen events.
tracing `readonly` [Tracing](./puppeteer.tracing.md) The Tracing class exposes the tracing audit interface.
## Methods
Method Modifiers Description
[$(selector)](./puppeteer.page._.md) Runs `document.querySelector` within the page. If no element matches the selector, the return value resolves to `null`.
[$$(selector)](./puppeteer.page.__.md) The method runs `document.querySelectorAll` within the page. If no elements match the selector, the return value resolves to `[]`.
[$$eval(selector, pageFunction, args)](./puppeteer.page.__eval.md) This method runs `Array.from(document.querySelectorAll(selector))` within the page and passes the result as the first argument to the `pageFunction`.
[$eval(selector, pageFunction, args)](./puppeteer.page._eval.md) This method runs `document.querySelector` within the page and passes the result as the first argument to the `pageFunction`.
[addScriptTag(options)](./puppeteer.page.addscripttag.md) Adds a `