Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in the browser.
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:
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.
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).
</td></tr>
<tr><td>
coverage
</td><td>
`readonly`
</td><td>
[Coverage](./puppeteer.coverage.md)
</td><td>
The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page.
</td></tr>
<tr><td>
keyboard
</td><td>
`readonly`
</td><td>
[Keyboard](./puppeteer.keyboard.md)
</td><td>
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.
</td></tr>
<tr><td>
mouse
</td><td>
`readonly`
</td><td>
[Mouse](./puppeteer.mouse.md)
</td><td>
The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
</td></tr>
<tr><td>
touchscreen
</td><td>
`readonly`
</td><td>
[Touchscreen](./puppeteer.touchscreen.md)
</td><td>
The Touchscreen class exposes touchscreen events.
</td></tr>
<tr><td>
tracing
</td><td>
`readonly`
</td><td>
[Tracing](./puppeteer.tracing.md)
</td><td>
The Tracing class exposes the tracing audit interface.
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If there's no element matching `selector`, the method throws an error.
</td></tr>
<tr><td>
[close(options)](./puppeteer.page.close.md)
</td><td>
</td><td>
</td></tr>
<tr><td>
[content()](./puppeteer.page.content.md)
</td><td>
</td><td>
The full HTML contents of the page, including the DOCTYPE.
</td></tr>
<tr><td>
[cookies(urls)](./puppeteer.page.cookies.md)
</td><td>
</td><td>
If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned.
This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644). To set the page offline, you can use [Page.setOfflineMode()](./puppeteer.page.setofflinemode.md).
A list of predefined network conditions can be used by importing [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md).
Adds a function which would be invoked in one of the following scenarios:
- whenever the page is navigated
- whenever the child frame is attached or navigated. In this case, the function is invoked in the context of the newly attached frame.
The function is invoked after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed `Math.random`.
The method adds a function called `name` on the page's `window` object. When called, the function executes `puppeteerFunction` in node.js and returns a `Promise` which resolves to the return value of `puppeteerFunction`.
If the puppeteerFunction returns a `Promise`, it will be awaited.
:::note
Functions installed via `page.exposeFunction` survive navigations.
:::
</td></tr>
<tr><td>
[focus(selector)](./puppeteer.page.focus.md)
</td><td>
</td><td>
This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method throws an error.
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to hover over the center of the element. If there's no element matching `selector`, the method throws an error.
We no longer support intercepting drag payloads. Use the new drag APIs found on [ElementHandle](./puppeteer.elementhandle.md) to drag (or just use the [Page.mouse](./puppeteer.page.md)).
The method removes a previously added function via $[Page.exposeFunction()](./puppeteer.page.exposefunction.md) called `name` from the page's `window` object.
Triggers a `change` and `input` event once all the provided options have been selected. If there's no `<select>` element matching `selector`, the method throws an error.
We no longer support intercepting drag payloads. Use the new drag APIs found on [ElementHandle](./puppeteer.elementhandle.md) to drag (or just use the [Page.mouse](./puppeteer.page.md)).
Activating request interception enables [HTTPRequest.abort()](./puppeteer.httprequest.abort.md), [HTTPRequest.continue()](./puppeteer.httprequest.continue.md) and [HTTPRequest.respond()](./puppeteer.httprequest.respond.md) methods. This provides the capability to modify network requests that are made by a page.
Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache.
See the [Request interception guide](https://pptr.dev/next/guides/request-interception) for more details.
`page.setViewport` will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating to the page.
In the case of multiple pages in a single browser, each page can have its own viewport size.
</td></tr>
<tr><td>
[tap(selector)](./puppeteer.page.tap.md)
</td><td>
</td><td>
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.md) to tap in the center of the element. If there's no element matching `selector`, the method throws an error.
Sends a `keydown`, `keypress/input`, and `keyup` event for each character in the text.
To press a special key, like `Control` or `ArrowDown`, use [Keyboard.press()](./puppeteer.keyboard.press.md).
</td></tr>
<tr><td>
[url()](./puppeteer.page.url.md)
</td><td>
</td><td>
The page's URL.
</td></tr>
<tr><td>
[viewport()](./puppeteer.page.viewport.md)
</td><td>
</td><td>
Returns the current page viewport settings without checking the actual page viewport.
This is either the viewport set with the previous [Page.setViewport()](./puppeteer.page.setviewport.md) call or the default viewport set via [BrowserConnectOptions.defaultViewport](./puppeteer.browserconnectoptions.md).
Wait for the `selector` to appear in page. If at the moment of calling the method the `selector` already exists, the method will return immediately. If the `selector` doesn't appear after the `timeout` milliseconds of waiting, the function will throw.
</td></tr>
<tr><td>
[workers()](./puppeteer.page.workers.md)
</td><td>
</td><td>
All of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.