mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: release main (#11742)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This commit is contained in:
parent
df0c43262b
commit
2f87accd67
@ -1,6 +1,6 @@
|
||||
{
|
||||
"packages/puppeteer": "21.7.0",
|
||||
"packages/puppeteer-core": "21.7.0",
|
||||
"packages/puppeteer": "21.8.0",
|
||||
"packages/puppeteer-core": "21.8.0",
|
||||
"packages/testserver": "0.6.0",
|
||||
"packages/ng-schematics": "0.5.6",
|
||||
"packages/browsers": "1.9.1"
|
||||
|
@ -4,6 +4,7 @@ The following versions of Chromium are supported, mapped to Puppeteer version. T
|
||||
|
||||
<!-- version-start -->
|
||||
|
||||
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 120.0.6099.109 - [Puppeteer v21.8.0](https://github.com/puppeteer/puppeteer/blob/puppeteer-v21.8.0/docs/api/index.md)
|
||||
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 119.0.6045.105 - [Puppeteer v21.5.0](https://github.com/puppeteer/puppeteer/blob/puppeteer-v21.5.0/docs/api/index.md)
|
||||
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 118.0.5993.70 - [Puppeteer v21.4.0](https://github.com/puppeteer/puppeteer/blob/puppeteer-v21.4.0/docs/api/index.md)
|
||||
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 117.0.5938.149 - [Puppeteer v21.3.7](https://github.com/puppeteer/puppeteer/blob/puppeteer-v21.3.7/docs/api/index.md)
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -10882,13 +10882,13 @@
|
||||
}
|
||||
},
|
||||
"packages/puppeteer": {
|
||||
"version": "21.7.0",
|
||||
"version": "21.8.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "1.9.1",
|
||||
"cosmiconfig": "9.0.0",
|
||||
"puppeteer-core": "21.7.0"
|
||||
"puppeteer-core": "21.8.0"
|
||||
},
|
||||
"bin": {
|
||||
"puppeteer": "lib/esm/puppeteer/node/cli.js"
|
||||
@ -10901,7 +10901,7 @@
|
||||
}
|
||||
},
|
||||
"packages/puppeteer-core": {
|
||||
"version": "21.7.0",
|
||||
"version": "21.8.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "1.9.1",
|
||||
|
@ -20,6 +20,24 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
* dependencies
|
||||
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0
|
||||
|
||||
## [21.8.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v21.7.0...puppeteer-core-v21.8.0) (2024-01-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* roll to Chrome 120.0.6099.109 (r1217362) ([#11733](https://github.com/puppeteer/puppeteer/issues/11733)) ([415cfac](https://github.com/puppeteer/puppeteer/commit/415cfaca202126b64ff496e4318cae64c4f14e89))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* expose function for Firefox BiDi ([#11660](https://github.com/puppeteer/puppeteer/issues/11660)) ([cf879b8](https://github.com/puppeteer/puppeteer/commit/cf879b82f6c10302fcafe186b315fe7807107c31))
|
||||
* wait for WebDriver BiDi browser to close gracefully ([#11636](https://github.com/puppeteer/puppeteer/issues/11636)) ([cc3aeeb](https://github.com/puppeteer/puppeteer/commit/cc3aeeb6eae4663198466755f23746ef821408ae))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* refactor: adopt `core/UserContext` on `BidiBrowserContext` ([#11721](https://github.com/puppeteer/puppeteer/issues/11721)) ([d17a9df](https://github.com/puppeteer/puppeteer/commit/d17a9df0278be34c206701d8dfc1fb62af3637b3))
|
||||
|
||||
## [21.7.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v21.6.1...puppeteer-core-v21.7.0) (2024-01-04)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppeteer-core",
|
||||
"version": "21.7.0",
|
||||
"version": "21.8.0",
|
||||
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
|
||||
"keywords": [
|
||||
"puppeteer",
|
||||
|
@ -29,6 +29,20 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
* puppeteer-core bumped from 21.0.2 to 21.0.3
|
||||
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0
|
||||
|
||||
## [21.8.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-v21.7.0...puppeteer-v21.8.0) (2024-01-24)
|
||||
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* **puppeteer:** Synchronize puppeteer versions
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* The following workspace dependencies were updated
|
||||
* dependencies
|
||||
* puppeteer-core bumped from 21.7.0 to 21.8.0
|
||||
|
||||
## [21.7.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-v21.6.1...puppeteer-v21.7.0) (2024-01-04)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppeteer",
|
||||
"version": "21.7.0",
|
||||
"version": "21.8.0",
|
||||
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
|
||||
"keywords": [
|
||||
"puppeteer",
|
||||
@ -124,7 +124,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"cosmiconfig": "9.0.0",
|
||||
"puppeteer-core": "21.7.0",
|
||||
"puppeteer-core": "21.8.0",
|
||||
"@puppeteer/browsers": "1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -7,7 +7,7 @@
|
||||
const versionsPerRelease = new Map([
|
||||
// This is a mapping from Chrome version => Puppeteer version.
|
||||
// In Chrome roll patches, use `NEXT` for the Puppeteer version.
|
||||
['120.0.6099.109', 'NEXT'],
|
||||
['120.0.6099.109', 'v21.8.0'],
|
||||
['119.0.6045.105', 'v21.5.0'],
|
||||
['118.0.5993.70', 'v21.4.0'],
|
||||
['117.0.5938.149', 'v21.3.7'],
|
||||
|
@ -1,61 +0,0 @@
|
||||
---
|
||||
sidebar_label: BrowserContext
|
||||
---
|
||||
|
||||
# BrowserContext class
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md) represents individual sessions within a [browser](./puppeteer.browser.md).
|
||||
|
||||
When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createIncognitoBrowserContext()](./puppeteer.browser.createincognitobrowsercontext.md).
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum.
|
||||
|
||||
If a [page](./puppeteer.page.md) opens another [page](./puppeteer.page.md), e.g. using `window.open`, the popup will belong to the parent [page's browser context](./puppeteer.page.browsercontext.md).
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class BrowserContext extends EventEmitter<BrowserContextEvents>
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[BrowserContextEvents](./puppeteer.browsercontextevents.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 `BrowserContext` class.
|
||||
|
||||
## Example
|
||||
|
||||
Creating an incognito [browser context](./puppeteer.browsercontext.md):
|
||||
|
||||
```ts
|
||||
// Create a new incognito browser context
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page inside context.
|
||||
const page = await context.newPage();
|
||||
// ... do stuff with page ...
|
||||
await page.goto('https://example.com');
|
||||
// Dispose context once it's no longer needed.
|
||||
await context.close();
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------------------- | ------------------------------------------------------------------------ |
|
||||
| closed | <code>readonly</code> | boolean | Whether this [browser context](./puppeteer.browsercontext.md) is closed. |
|
||||
| id | <code>readonly</code> | string \| undefined | Identifier for this [browser context](./puppeteer.browsercontext.md). |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browser()](./puppeteer.browsercontext.browser.md) | | Gets the [browser](./puppeteer.browser.md) associated with this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [close()](./puppeteer.browsercontext.close.md) | | Closes this [browser context](./puppeteer.browsercontext.md) and all associated [pages](./puppeteer.page.md). |
|
||||
| [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | <p>Whether this [browser context](./puppeteer.browsercontext.md) is incognito.</p><p>The [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context.</p> |
|
||||
| [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new [page](./puppeteer.page.md) in this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | Grants this [browser context](./puppeteer.browsercontext.md) the given <code>permissions</code> within the given <code>origin</code>. |
|
||||
| [pages()](./puppeteer.browsercontext.pages.md) | | Gets a list of all open [pages](./puppeteer.page.md) inside this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [targets()](./puppeteer.browsercontext.targets.md) | | Gets all active [targets](./puppeteer.target.md) inside this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md) | | <p>Waits until a [target](./puppeteer.target.md) matching the given <code>predicate</code> appears and returns it.</p><p>This will look all open [browser contexts](./puppeteer.browsercontext.md).</p> |
|
@ -1,24 +0,0 @@
|
||||
---
|
||||
sidebar_label: CommonEventEmitter
|
||||
---
|
||||
|
||||
# CommonEventEmitter interface
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export interface CommonEventEmitter<Events extends Record<EventType, unknown>>
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| --------------------------------------------------------------------------------- | ----------- |
|
||||
| [addListener(type, handler)](./puppeteer.commoneventemitter.addlistener.md) | |
|
||||
| [emit(type, event)](./puppeteer.commoneventemitter.emit.md) | |
|
||||
| [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | |
|
||||
| [off(type, handler)](./puppeteer.commoneventemitter.off.md) | |
|
||||
| [on(type, handler)](./puppeteer.commoneventemitter.on.md) | |
|
||||
| [once(type, handler)](./puppeteer.commoneventemitter.once.md) | |
|
||||
| [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | |
|
||||
| [removeListener(type, handler)](./puppeteer.commoneventemitter.removelistener.md) | |
|
@ -1,36 +0,0 @@
|
||||
---
|
||||
sidebar_label: Connection
|
||||
---
|
||||
|
||||
# Connection class
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class Connection extends EventEmitter<CDPSessionEvents>
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[CDPSessionEvents](./puppeteer.cdpsessionevents.md)>
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------- |
|
||||
| [(constructor)(url, transport, delay, timeout)](./puppeteer.connection._constructor_.md) | | Constructs a new instance of the <code>Connection</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------ | ----------- |
|
||||
| timeout | <code>readonly</code> | number | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------------------------- | ------------------- | ----------- |
|
||||
| [createSession(targetInfo)](./puppeteer.connection.createsession.md) | | |
|
||||
| [dispose()](./puppeteer.connection.dispose.md) | | |
|
||||
| [fromSession(session)](./puppeteer.connection.fromsession.md) | <code>static</code> | |
|
||||
| [send(method, params, options)](./puppeteer.connection.send.md) | | |
|
||||
| [session(sessionId)](./puppeteer.connection.session.md) | | |
|
||||
| [url()](./puppeteer.connection.url.md) | | |
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
sidebar_label: ConsoleMessage
|
||||
---
|
||||
|
||||
# ConsoleMessage class
|
||||
|
||||
ConsoleMessage objects are dispatched by page via the 'console' event.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class ConsoleMessage
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------ |
|
||||
| [(constructor)(type, text, args, stackTraceLocations)](./puppeteer.consolemessage._constructor_.md) | | Constructs a new instance of the <code>ConsoleMessage</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------------- | --------- | ----------------------------------------------------------- |
|
||||
| [args()](./puppeteer.consolemessage.args.md) | | An array of arguments passed to the console. |
|
||||
| [location()](./puppeteer.consolemessage.location.md) | | The location of the console message. |
|
||||
| [stackTrace()](./puppeteer.consolemessage.stacktrace.md) | | The array of locations on the stack of the console message. |
|
||||
| [text()](./puppeteer.consolemessage.text.md) | | The text of the console message. |
|
||||
| [type()](./puppeteer.consolemessage.type.md) | | The type of the console message. |
|
@ -1,59 +0,0 @@
|
||||
---
|
||||
sidebar_label: Coverage
|
||||
---
|
||||
|
||||
# Coverage class
|
||||
|
||||
The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class Coverage
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
To output coverage in a form consumable by [Istanbul](https://github.com/istanbuljs), see [puppeteer-to-istanbul](https://github.com/istanbuljs/puppeteer-to-istanbul).
|
||||
|
||||
## Example
|
||||
|
||||
An example of using JavaScript and CSS coverage to get percentage of initially executed code:
|
||||
|
||||
```ts
|
||||
// Enable both JavaScript and CSS coverage
|
||||
await Promise.all([
|
||||
page.coverage.startJSCoverage(),
|
||||
page.coverage.startCSSCoverage(),
|
||||
]);
|
||||
// Navigate to page
|
||||
await page.goto('https://example.com');
|
||||
// Disable both JavaScript and CSS coverage
|
||||
const [jsCoverage, cssCoverage] = await Promise.all([
|
||||
page.coverage.stopJSCoverage(),
|
||||
page.coverage.stopCSSCoverage(),
|
||||
]);
|
||||
let totalBytes = 0;
|
||||
let usedBytes = 0;
|
||||
const coverage = [...jsCoverage, ...cssCoverage];
|
||||
for (const entry of coverage) {
|
||||
totalBytes += entry.text.length;
|
||||
for (const range of entry.ranges) usedBytes += range.end - range.start - 1;
|
||||
}
|
||||
console.log(`Bytes used: ${(usedBytes / totalBytes) * 100}%`);
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| -------------------------------------------------------------- | --------- | ------------------------------------------------------------ |
|
||||
| [(constructor)(client)](./puppeteer.coverage._constructor_.md) | | Constructs a new instance of the <code>Coverage</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- |
|
||||
| [startCSSCoverage(options)](./puppeteer.coverage.startcsscoverage.md) | | |
|
||||
| [startJSCoverage(options)](./puppeteer.coverage.startjscoverage.md) | | |
|
||||
| [stopCSSCoverage()](./puppeteer.coverage.stopcsscoverage.md) | | Promise that resolves to the array of coverage reports for all stylesheets. |
|
||||
| [stopJSCoverage()](./puppeteer.coverage.stopjscoverage.md) | | Promise that resolves to the array of coverage reports for all scripts. |
|
@ -1,24 +0,0 @@
|
||||
---
|
||||
sidebar_label: CSSCoverage
|
||||
---
|
||||
|
||||
# CSSCoverage class
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class CSSCoverage
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| ----------------------------------------------------------------- | --------- | --------------------------------------------------------------- |
|
||||
| [(constructor)(client)](./puppeteer.csscoverage._constructor_.md) | | Constructs a new instance of the <code>CSSCoverage</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------- | --------- | ----------- |
|
||||
| [start(options)](./puppeteer.csscoverage.start.md) | | |
|
||||
| [stop()](./puppeteer.csscoverage.stop.md) | | |
|
@ -1,44 +0,0 @@
|
||||
---
|
||||
sidebar_label: Dialog
|
||||
---
|
||||
|
||||
# Dialog class
|
||||
|
||||
Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the `dialog` event.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Dialog
|
||||
```
|
||||
|
||||
## 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 `Dialog` class.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import puppeteer from 'puppeteer';
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
page.on('dialog', async dialog => {
|
||||
console.log(dialog.message());
|
||||
await dialog.dismiss();
|
||||
await browser.close();
|
||||
});
|
||||
page.evaluate(() => alert('1'));
|
||||
})();
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
|
||||
| [accept(promptText)](./puppeteer.dialog.accept.md) | | A promise that resolves when the dialog has been accepted. |
|
||||
| [defaultValue()](./puppeteer.dialog.defaultvalue.md) | | The default value of the prompt, or an empty string if the dialog is not a <code>prompt</code>. |
|
||||
| [dismiss()](./puppeteer.dialog.dismiss.md) | | A promise which will resolve once the dialog has been dismissed |
|
||||
| [message()](./puppeteer.dialog.message.md) | | The message displayed in the dialog. |
|
||||
| [type()](./puppeteer.dialog.type.md) | | The type of the dialog. |
|
@ -1,88 +0,0 @@
|
||||
---
|
||||
sidebar_label: ElementHandle
|
||||
---
|
||||
|
||||
# ElementHandle class
|
||||
|
||||
ElementHandle represents an in-page DOM element.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class ElementHandle<ElementType extends Node = Element> extends JSHandle<ElementType>
|
||||
```
|
||||
|
||||
**Extends:** [JSHandle](./puppeteer.jshandle.md)<ElementType>
|
||||
|
||||
## Remarks
|
||||
|
||||
ElementHandles can be created with the [Page.$()](./puppeteer.page._.md) method.
|
||||
|
||||
```ts
|
||||
import puppeteer from 'puppeteer';
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://example.com');
|
||||
const hrefElement = await page.$('a');
|
||||
await hrefElement.click();
|
||||
// ...
|
||||
})();
|
||||
```
|
||||
|
||||
ElementHandle prevents the DOM element from being garbage-collected unless the handle is [disposed](./puppeteer.jshandle.dispose.md). ElementHandles are auto-disposed when their origin frame gets navigated.
|
||||
|
||||
ElementHandle instances can be used as arguments in [Page.$eval()](./puppeteer.page._eval.md) and [Page.evaluate()](./puppeteer.page.evaluate.md) methods.
|
||||
|
||||
If you're using TypeScript, ElementHandle takes a generic argument that denotes the type of element the handle is holding within. For example, if you have a handle to a `<select>` element, you can type it as `ElementHandle<HTMLSelectElement>` and you get some nicer type checks.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `ElementHandle` class.
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ----------------------------- | ------------------------------------------ |
|
||||
| frame | <code>readonly</code> | [Frame](./puppeteer.frame.md) | Frame corresponding to the current handle. |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [$(selector)](./puppeteer.elementhandle._.md) | | Queries the current element for an element matching the given selector. |
|
||||
| [$$(selector)](./puppeteer.elementhandle.__.md) | | Queries the current element for all elements matching the given selector. |
|
||||
| [$$eval(selector, pageFunction, args)](./puppeteer.elementhandle.__eval.md) | | <p>Runs the given function on an array of elements matching the given selector in the current element.</p><p>If the given function returns a promise, then this method will wait till the promise resolves.</p> |
|
||||
| [$eval(selector, pageFunction, args)](./puppeteer.elementhandle._eval.md) | | <p>Runs the given function on the first element matching the given selector in the current element.</p><p>If the given function returns a promise, then this method will wait till the promise resolves.</p> |
|
||||
| [$x(expression)](./puppeteer.elementhandle._x.md) | | |
|
||||
| [autofill(data)](./puppeteer.elementhandle.autofill.md) | | If the element is a form input, you can use [ElementHandle.autofill()](./puppeteer.elementhandle.autofill.md) to test if the form is compatible with the browser's autofill implementation. Throws an error if the form cannot be autofilled. |
|
||||
| [boundingBox()](./puppeteer.elementhandle.boundingbox.md) | | This method returns the bounding box of the element (relative to the main frame), or <code>null</code> if the element is [not part of the layout](https://drafts.csswg.org/css-display-4/#box-generation) (example: <code>display: none</code>). |
|
||||
| [boxModel()](./puppeteer.elementhandle.boxmodel.md) | | This method returns boxes of the element, or <code>null</code> if the element is [not part of the layout](https://drafts.csswg.org/css-display-4/#box-generation) (example: <code>display: none</code>). |
|
||||
| [click(this, options)](./puppeteer.elementhandle.click.md) | | This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If the element is detached from DOM, the method throws an error. |
|
||||
| [clickablePoint(offset)](./puppeteer.elementhandle.clickablepoint.md) | | Returns the middle point within an element unless a specific offset is provided. |
|
||||
| [contentFrame(this)](./puppeteer.elementhandle.contentframe.md) | | Resolves the frame associated with the element, if any. Always exists for HTMLIFrameElements. |
|
||||
| [contentFrame()](./puppeteer.elementhandle.contentframe_1.md) | | |
|
||||
| [drag(this, target)](./puppeteer.elementhandle.drag.md) | | Drags an element over the given element or point. |
|
||||
| [dragAndDrop(this, target, options)](./puppeteer.elementhandle.draganddrop.md) | | |
|
||||
| [dragEnter(this, data)](./puppeteer.elementhandle.dragenter.md) | | |
|
||||
| [dragOver(this, data)](./puppeteer.elementhandle.dragover.md) | | |
|
||||
| [drop(this, element)](./puppeteer.elementhandle.drop.md) | | Drops the given element onto the current one. |
|
||||
| [drop(this, data)](./puppeteer.elementhandle.drop_1.md) | | |
|
||||
| [focus()](./puppeteer.elementhandle.focus.md) | | Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element. |
|
||||
| [hover(this)](./puppeteer.elementhandle.hover.md) | | This method scrolls element into view if needed, and then uses [Page](./puppeteer.page.md) to hover over the center of the element. If the element is detached from DOM, the method throws an error. |
|
||||
| [isHidden()](./puppeteer.elementhandle.ishidden.md) | | Checks if an element is hidden using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). |
|
||||
| [isIntersectingViewport(this, options)](./puppeteer.elementhandle.isintersectingviewport.md) | | Resolves to true if the element is visible in the current viewport. If an element is an SVG, we check if the svg owner element is in the viewport instead. See https://crbug.com/963246. |
|
||||
| [isVisible()](./puppeteer.elementhandle.isvisible.md) | | Checks if an element is visible using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). |
|
||||
| [press(key, options)](./puppeteer.elementhandle.press.md) | | Focuses the element, and then uses [Keyboard.down()](./puppeteer.keyboard.down.md) and [Keyboard.up()](./puppeteer.keyboard.up.md). |
|
||||
| [screenshot(options)](./puppeteer.elementhandle.screenshot.md) | | This method scrolls element into view if needed, and then uses [Page.screenshot()](./puppeteer.page.screenshot_1.md) to take a screenshot of the element. If the element is detached from DOM, the method throws an error. |
|
||||
| [screenshot(options)](./puppeteer.elementhandle.screenshot_1.md) | | |
|
||||
| [scrollIntoView(this)](./puppeteer.elementhandle.scrollintoview.md) | | Scrolls the element into view using either the automation protocol client or by calling element.scrollIntoView. |
|
||||
| [select(values)](./puppeteer.elementhandle.select.md) | | Triggers a <code>change</code> and <code>input</code> event once all the provided options have been selected. If there's no <code><select></code> element matching <code>selector</code>, the method throws an error. |
|
||||
| [tap(this)](./puppeteer.elementhandle.tap.md) | | This method scrolls element into view if needed, and then uses [Touchscreen.tap()](./puppeteer.touchscreen.tap.md) to tap in the center of the element. If the element is detached from DOM, the method throws an error. |
|
||||
| [toElement(tagName)](./puppeteer.elementhandle.toelement.md) | | Converts the current handle to the given element type. |
|
||||
| [touchEnd(this)](./puppeteer.elementhandle.touchend.md) | | |
|
||||
| [touchMove(this)](./puppeteer.elementhandle.touchmove.md) | | |
|
||||
| [touchStart(this)](./puppeteer.elementhandle.touchstart.md) | | |
|
||||
| [type(text, options)](./puppeteer.elementhandle.type.md) | | <p>Focuses the element, and then sends a <code>keydown</code>, <code>keypress</code>/<code>input</code>, and <code>keyup</code> event for each character in the text.</p><p>To press a special key, like <code>Control</code> or <code>ArrowDown</code>, use [ElementHandle.press()](./puppeteer.elementhandle.press.md).</p> |
|
||||
| [uploadFile(this, paths)](./puppeteer.elementhandle.uploadfile.md) | | Sets the value of an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) to the given file paths. |
|
||||
| [waitForSelector(selector, options)](./puppeteer.elementhandle.waitforselector.md) | | <p>Wait for an element matching the given selector to appear in the current element.</p><p>Unlike [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), this method does not work across navigations or if the element is detached from DOM.</p> |
|
||||
| [waitForXPath(xpath, options)](./puppeteer.elementhandle.waitforxpath.md) | | |
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
sidebar_label: EventEmitter
|
||||
---
|
||||
|
||||
# EventEmitter class
|
||||
|
||||
The EventEmitter class that many Puppeteer classes extend.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class EventEmitter<Events extends Record<EventType, unknown>> implements CommonEventEmitter<EventsWithWildcard<Events>>
|
||||
```
|
||||
|
||||
**Implements:** [CommonEventEmitter](./puppeteer.commoneventemitter.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>>
|
||||
|
||||
## Remarks
|
||||
|
||||
This allows you to listen to events that Puppeteer classes fire and act accordingly. Therefore you'll mostly use [on](./puppeteer.eventemitter.on.md) and [off](./puppeteer.eventemitter.off.md) to bind and unbind to event listeners.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `EventEmitter` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------ |
|
||||
| [addListener(type, handler)](./puppeteer.eventemitter.addlistener.md) | | Add an event listener. |
|
||||
| [emit(type, event)](./puppeteer.eventemitter.emit.md) | | Emit an event and call any associated listeners. |
|
||||
| [listenerCount(type)](./puppeteer.eventemitter.listenercount.md) | | Gets the number of listeners for a given event. |
|
||||
| [off(type, handler)](./puppeteer.eventemitter.off.md) | | Remove an event listener from firing. |
|
||||
| [on(type, handler)](./puppeteer.eventemitter.on.md) | | Bind an event listener to fire when an event occurs. |
|
||||
| [once(type, handler)](./puppeteer.eventemitter.once.md) | | Like <code>on</code> but the listener will only be fired once and then it will be removed. |
|
||||
| [removeAllListeners(type)](./puppeteer.eventemitter.removealllisteners.md) | | Removes all listeners. If given an event argument, it will remove only listeners for that event. |
|
||||
| [removeListener(type, handler)](./puppeteer.eventemitter.removelistener.md) | | Remove an event listener. |
|
@ -1,107 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame
|
||||
---
|
||||
|
||||
# Frame class
|
||||
|
||||
Represents a DOM frame.
|
||||
|
||||
To understand frames, you can think of frames as `<iframe>` elements. Just like iframes, frames can be nested, and when JavaScript is executed in a frame, the JavaScript does not effect frames inside the ambient frame the JavaScript executes in.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Frame extends EventEmitter<FrameEvents>
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[FrameEvents](./puppeteer.frameevents.md)>
|
||||
|
||||
## Remarks
|
||||
|
||||
Frame lifecycles are controlled by three events that are all dispatched on the parent [page](./puppeteer.frame.page.md):
|
||||
|
||||
- [PageEvent.FrameAttached](./puppeteer.pageevent.md) - [PageEvent.FrameNavigated](./puppeteer.pageevent.md) - [PageEvent.FrameDetached](./puppeteer.pageevent.md)
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Frame` class.
|
||||
|
||||
## Example 1
|
||||
|
||||
At any point in time, [pages](./puppeteer.page.md) expose their current frame tree via the [Page.mainFrame()](./puppeteer.page.mainframe.md) and [Frame.childFrames()](./puppeteer.frame.childframes.md) methods.
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of dumping frame tree:
|
||||
|
||||
```ts
|
||||
import puppeteer from 'puppeteer';
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://www.google.com/chrome/browser/canary.html');
|
||||
dumpFrameTree(page.mainFrame(), '');
|
||||
await browser.close();
|
||||
|
||||
function dumpFrameTree(frame, indent) {
|
||||
console.log(indent + frame.url());
|
||||
for (const child of frame.childFrames()) {
|
||||
dumpFrameTree(child, indent + ' ');
|
||||
}
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
## Example 3
|
||||
|
||||
An example of getting text from an iframe element:
|
||||
|
||||
```ts
|
||||
const frame = page.frames().find(frame => frame.name() === 'myframe');
|
||||
const text = await frame.$eval('.selector', element => element.textContent);
|
||||
console.log(text);
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------- | ----------- |
|
||||
| detached | <code>readonly</code> | boolean | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------------------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [$(selector)](./puppeteer.frame._.md) | | Queries the frame for an element matching the given selector. |
|
||||
| [$$(selector)](./puppeteer.frame.__.md) | | Queries the frame for all elements matching the given selector. |
|
||||
| [$$eval(selector, pageFunction, args)](./puppeteer.frame.__eval.md) | | <p>Runs the given function on an array of elements matching the given selector in the frame.</p><p>If the given function returns a promise, then this method will wait till the promise resolves.</p> |
|
||||
| [$eval(selector, pageFunction, args)](./puppeteer.frame._eval.md) | | <p>Runs the given function on the first element matching the given selector in the frame.</p><p>If the given function returns a promise, then this method will wait till the promise resolves.</p> |
|
||||
| [$x(expression)](./puppeteer.frame._x.md) | | |
|
||||
| [addScriptTag(options)](./puppeteer.frame.addscripttag.md) | | Adds a <code><script></code> tag into the page with the desired url or content. |
|
||||
| [addStyleTag(options)](./puppeteer.frame.addstyletag.md) | | Adds a <code>HTMLStyleElement</code> into the frame with the desired URL |
|
||||
| [addStyleTag(options)](./puppeteer.frame.addstyletag_1.md) | | Adds a <code>HTMLLinkElement</code> into the frame with the desired URL |
|
||||
| [childFrames()](./puppeteer.frame.childframes.md) | | An array of child frames. |
|
||||
| [click(selector, options)](./puppeteer.frame.click.md) | | Clicks the first element found that matches <code>selector</code>. |
|
||||
| [content()](./puppeteer.frame.content.md) | | The full HTML contents of the frame, including the DOCTYPE. |
|
||||
| [evaluate(pageFunction, args)](./puppeteer.frame.evaluate.md) | | Behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it's run within the the context of this frame. |
|
||||
| [evaluateHandle(pageFunction, args)](./puppeteer.frame.evaluatehandle.md) | | Behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md) except it's run within the context of this frame. |
|
||||
| [focus(selector)](./puppeteer.frame.focus.md) | | Focuses the first element that matches the <code>selector</code>. |
|
||||
| [goto(url, options)](./puppeteer.frame.goto.md) | | Navigates the frame to the given <code>url</code>. |
|
||||
| [hover(selector)](./puppeteer.frame.hover.md) | | Hovers the pointer over the center of the first element that matches the <code>selector</code>. |
|
||||
| [isDetached()](./puppeteer.frame.isdetached.md) | | Is<code>true</code> if the frame has been detached. Otherwise, <code>false</code>. |
|
||||
| [isOOPFrame()](./puppeteer.frame.isoopframe.md) | | Is <code>true</code> if the frame is an out-of-process (OOP) frame. Otherwise, <code>false</code>. |
|
||||
| [locator(selector)](./puppeteer.frame.locator.md) | | Creates a locator for the provided selector. See [Locator](./puppeteer.locator.md) for details and supported actions. |
|
||||
| [locator(func)](./puppeteer.frame.locator_1.md) | | Creates a locator for the provided function. See [Locator](./puppeteer.locator.md) for details and supported actions. |
|
||||
| [name()](./puppeteer.frame.name.md) | | The frame's <code>name</code> attribute as specified in the tag. |
|
||||
| [page()](./puppeteer.frame.page.md) | | The page associated with the frame. |
|
||||
| [parentFrame()](./puppeteer.frame.parentframe.md) | | The parent frame, if any. Detached and main frames return <code>null</code>. |
|
||||
| [select(selector, values)](./puppeteer.frame.select.md) | | Selects a set of value on the first <code><select></code> element that matches the <code>selector</code>. |
|
||||
| [setContent(html, options)](./puppeteer.frame.setcontent.md) | | Set the content of the frame. |
|
||||
| [tap(selector)](./puppeteer.frame.tap.md) | | Taps the first element that matches the <code>selector</code>. |
|
||||
| [title()](./puppeteer.frame.title.md) | | The frame's title. |
|
||||
| [type(selector, text, options)](./puppeteer.frame.type.md) | | Sends a <code>keydown</code>, <code>keypress</code>/<code>input</code>, and <code>keyup</code> event for each character in the text. |
|
||||
| [url()](./puppeteer.frame.url.md) | | The frame's URL. |
|
||||
| [waitForFunction(pageFunction, options, args)](./puppeteer.frame.waitforfunction.md) | | |
|
||||
| [waitForNavigation(options)](./puppeteer.frame.waitfornavigation.md) | | <p>Waits for the frame to navigate. It is useful for when you run code which will indirectly cause the frame to navigate.</p><p>Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.</p> |
|
||||
| [waitForSelector(selector, options)](./puppeteer.frame.waitforselector.md) | | <p>Waits for an element matching the given selector to appear in the frame.</p><p>This method works across navigations.</p> |
|
||||
| [waitForTimeout(milliseconds)](./puppeteer.frame.waitfortimeout.md) | | |
|
||||
| [waitForXPath(xpath, options)](./puppeteer.frame.waitforxpath.md) | | |
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
sidebar_label: HTTPResponse
|
||||
---
|
||||
|
||||
# HTTPResponse class
|
||||
|
||||
The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class HTTPResponse
|
||||
```
|
||||
|
||||
## 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 `HTTPResponse` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [buffer()](./puppeteer.httpresponse.buffer.md) | | Promise which resolves to a buffer with response body. |
|
||||
| [frame()](./puppeteer.httpresponse.frame.md) | | A [Frame](./puppeteer.frame.md) that initiated this response, or <code>null</code> if navigating to error pages. |
|
||||
| [fromCache()](./puppeteer.httpresponse.fromcache.md) | | True if the response was served from either the browser's disk cache or memory cache. |
|
||||
| [fromServiceWorker()](./puppeteer.httpresponse.fromserviceworker.md) | | True if the response was served by a service worker. |
|
||||
| [headers()](./puppeteer.httpresponse.headers.md) | | An object with HTTP headers associated with the response. All header names are lower-case. |
|
||||
| [json()](./puppeteer.httpresponse.json.md) | | Promise which resolves to a JSON representation of response body. |
|
||||
| [ok()](./puppeteer.httpresponse.ok.md) | | True if the response was successful (status in the range 200-299). |
|
||||
| [remoteAddress()](./puppeteer.httpresponse.remoteaddress.md) | | The IP address and port number used to connect to the remote server. |
|
||||
| [request()](./puppeteer.httpresponse.request.md) | | A matching [HTTPRequest](./puppeteer.httprequest.md) object. |
|
||||
| [securityDetails()](./puppeteer.httpresponse.securitydetails.md) | | [SecurityDetails](./puppeteer.securitydetails.md) if the response was received over the secure connection, or <code>null</code> otherwise. |
|
||||
| [status()](./puppeteer.httpresponse.status.md) | | The status code of the response (e.g., 200 for a success). |
|
||||
| [statusText()](./puppeteer.httpresponse.statustext.md) | | The status text of the response (e.g. usually an "OK" for a success). |
|
||||
| [text()](./puppeteer.httpresponse.text.md) | | Promise which resolves to a text representation of response body. |
|
||||
| [timing()](./puppeteer.httpresponse.timing.md) | | Timing information related to the response. |
|
||||
| [url()](./puppeteer.httpresponse.url.md) | | The URL of the response. |
|
@ -1,24 +0,0 @@
|
||||
---
|
||||
sidebar_label: JSCoverage
|
||||
---
|
||||
|
||||
# JSCoverage class
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class JSCoverage
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| ---------------------------------------------------------------- | --------- | -------------------------------------------------------------- |
|
||||
| [(constructor)(client)](./puppeteer.jscoverage._constructor_.md) | | Constructs a new instance of the <code>JSCoverage</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------- | --------- | ----------- |
|
||||
| [start(options)](./puppeteer.jscoverage.start.md) | | |
|
||||
| [stop()](./puppeteer.jscoverage.stop.md) | | |
|
@ -1,49 +0,0 @@
|
||||
---
|
||||
sidebar_label: JSHandle
|
||||
---
|
||||
|
||||
# JSHandle class
|
||||
|
||||
Represents a reference to a JavaScript object. Instances can be created using [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md).
|
||||
|
||||
Handles prevent the referenced JavaScript object from being garbage-collected unless the handle is purposely [disposed](./puppeteer.jshandle.dispose.md). JSHandles are auto-disposed when their associated frame is navigated away or the parent context gets destroyed.
|
||||
|
||||
Handles can be used as arguments for any evaluation function such as [Page.$eval()](./puppeteer.page._eval.md), [Page.evaluate()](./puppeteer.page.evaluate.md), and [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md). They are resolved to their referenced object.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class JSHandle<T = unknown>
|
||||
```
|
||||
|
||||
## 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 `JSHandle` class.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const windowHandle = await page.evaluateHandle(() => window);
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------------- | -------------------------------------------------------------- |
|
||||
| \_ | <code>optional</code> | T | Used for nominally typing [JSHandle](./puppeteer.jshandle.md). |
|
||||
| move | | () => this | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [asElement()](./puppeteer.jshandle.aselement.md) | | Either <code>null</code> or the handle itself if the handle is an instance of [ElementHandle](./puppeteer.elementhandle.md). |
|
||||
| [dispose()](./puppeteer.jshandle.dispose.md) | | Releases the object referenced by the handle for garbage collection. |
|
||||
| [evaluate(pageFunction, args)](./puppeteer.jshandle.evaluate.md) | | Evaluates the given function with the current handle as its first argument. |
|
||||
| [evaluateHandle(pageFunction, args)](./puppeteer.jshandle.evaluatehandle.md) | | Evaluates the given function with the current handle as its first argument. |
|
||||
| [getProperties()](./puppeteer.jshandle.getproperties.md) | | Gets a map of handles representing the properties of the current handle. |
|
||||
| [getProperty(propertyName)](./puppeteer.jshandle.getproperty.md) | | Fetches a single property from the referenced object. |
|
||||
| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_1.md) | | |
|
||||
| [jsonValue()](./puppeteer.jshandle.jsonvalue.md) | | A vanilla object representing the serializable portions of the referenced object. |
|
||||
| [remoteObject()](./puppeteer.jshandle.remoteobject.md) | | Provides access to the [Protocol.Runtime.RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject) backing this handle. |
|
||||
| [toString()](./puppeteer.jshandle.tostring.md) | | Returns a string representation of the JSHandle. |
|
@ -1,42 +0,0 @@
|
||||
---
|
||||
sidebar_label: Locator
|
||||
---
|
||||
|
||||
# Locator class
|
||||
|
||||
Locators describe a strategy of locating objects and performing an action on them. If the action fails because the object is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Locator<T> extends EventEmitter<LocatorEvents>
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[LocatorEvents](./puppeteer.locatorevents.md)>
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------ | ------------------------------------------------------------ |
|
||||
| \_ | <code>optional</code> | T | Used for nominally typing [Locator](./puppeteer.locator.md). |
|
||||
| timeout | <code>readonly</code> | number | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------------------------------------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [click(this, options)](./puppeteer.locator.click.md) | | |
|
||||
| [clone()](./puppeteer.locator.clone.md) | | Clones the locator. |
|
||||
| [fill(this, value, options)](./puppeteer.locator.fill.md) | | Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable, selector, inputs are supported. |
|
||||
| [filter(predicate)](./puppeteer.locator.filter.md) | | <p>Creates an expectation that is evaluated against located values.</p><p>If the expectations do not match, then the locator will retry.</p> |
|
||||
| [hover(this, options)](./puppeteer.locator.hover.md) | | |
|
||||
| [map(mapper)](./puppeteer.locator.map.md) | | Maps the locator using the provided mapper. |
|
||||
| [race(locators)](./puppeteer.locator.race.md) | <code>static</code> | Creates a race between multiple locators but ensures that only a single one acts. |
|
||||
| [scroll(this, options)](./puppeteer.locator.scroll.md) | | |
|
||||
| [setEnsureElementIsInTheViewport(this, value)](./puppeteer.locator.setensureelementisintheviewport.md) | | |
|
||||
| [setTimeout(timeout)](./puppeteer.locator.settimeout.md) | | |
|
||||
| [setVisibility(this, visibility)](./puppeteer.locator.setvisibility.md) | | |
|
||||
| [setWaitForEnabled(this, value)](./puppeteer.locator.setwaitforenabled.md) | | |
|
||||
| [setWaitForStableBoundingBox(this, value)](./puppeteer.locator.setwaitforstableboundingbox.md) | | |
|
||||
| [wait(options)](./puppeteer.locator.wait.md) | | <p>Waits for the locator to get the serialized value from the page.</p><p>Note this requires the value to be JSON-serializable.</p> |
|
||||
| [waitHandle(options)](./puppeteer.locator.waithandle.md) | | Waits for the locator to get a handle from the page. |
|
@ -1,92 +0,0 @@
|
||||
---
|
||||
sidebar_label: Mouse
|
||||
---
|
||||
|
||||
# Mouse class
|
||||
|
||||
The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Mouse
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
Every `page` object has its own Mouse, accessible with \[`page.mouse`\](\#pagemouse).
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Mouse` class.
|
||||
|
||||
## Example 1
|
||||
|
||||
```ts
|
||||
// Using ‘page.mouse’ to trace a 100x100 square.
|
||||
await page.mouse.move(0, 0);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(0, 100);
|
||||
await page.mouse.move(100, 100);
|
||||
await page.mouse.move(100, 0);
|
||||
await page.mouse.move(0, 0);
|
||||
await page.mouse.up();
|
||||
```
|
||||
|
||||
**Note**: The mouse events trigger synthetic `MouseEvent`s. This means that it does not fully replicate the functionality of what a normal user would be able to do with their mouse.
|
||||
|
||||
For example, dragging and selecting text is not possible using `page.mouse`. Instead, you can use the [\`DocumentOrShadowRoot.getSelection()\`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/getSelection) functionality implemented in the platform.
|
||||
|
||||
## Example 2
|
||||
|
||||
For example, if you want to select all content between nodes:
|
||||
|
||||
```ts
|
||||
await page.evaluate(
|
||||
(from, to) => {
|
||||
const selection = from.getRootNode().getSelection();
|
||||
const range = document.createRange();
|
||||
range.setStartBefore(from);
|
||||
range.setEndAfter(to);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
},
|
||||
fromJSHandle,
|
||||
toJSHandle
|
||||
);
|
||||
```
|
||||
|
||||
If you then would want to copy-paste your selection, you can use the clipboard api:
|
||||
|
||||
```ts
|
||||
// The clipboard api does not allow you to copy, unless the tab is focused.
|
||||
await page.bringToFront();
|
||||
await page.evaluate(() => {
|
||||
// Copy the selected content to the clipboard
|
||||
document.execCommand('copy');
|
||||
// Obtain the content of the clipboard as a string
|
||||
return navigator.clipboard.readText();
|
||||
});
|
||||
```
|
||||
|
||||
**Note**: If you want access to the clipboard API, you have to give it permission to do so:
|
||||
|
||||
```ts
|
||||
await browser
|
||||
.defaultBrowserContext()
|
||||
.overridePermissions('<your origin>', ['clipboard-read', 'clipboard-write']);
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ----------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------- |
|
||||
| [click(x, y, options)](./puppeteer.mouse.click.md) | | Shortcut for <code>mouse.move</code>, <code>mouse.down</code> and <code>mouse.up</code>. |
|
||||
| [down(options)](./puppeteer.mouse.down.md) | | Presses the mouse. |
|
||||
| [drag(start, target)](./puppeteer.mouse.drag.md) | | Dispatches a <code>drag</code> event. |
|
||||
| [dragAndDrop(start, target, options)](./puppeteer.mouse.draganddrop.md) | | Performs a drag, dragenter, dragover, and drop in sequence. |
|
||||
| [dragEnter(target, data)](./puppeteer.mouse.dragenter.md) | | Dispatches a <code>dragenter</code> event. |
|
||||
| [dragOver(target, data)](./puppeteer.mouse.dragover.md) | | Dispatches a <code>dragover</code> event. |
|
||||
| [drop(target, data)](./puppeteer.mouse.drop.md) | | Performs a dragenter, dragover, and drop in sequence. |
|
||||
| [move(x, y, options)](./puppeteer.mouse.move.md) | | Moves the mouse to the given coordinate. |
|
||||
| [reset()](./puppeteer.mouse.reset.md) | | Resets the mouse to the default state: No buttons pressed; position at (0,0). |
|
||||
| [up(options)](./puppeteer.mouse.up.md) | | Releases the mouse. |
|
||||
| [wheel(options)](./puppeteer.mouse.wheel.md) | | Dispatches a <code>mousewheel</code> event. |
|
@ -1,17 +0,0 @@
|
||||
---
|
||||
sidebar_label: Moveable
|
||||
---
|
||||
|
||||
# Moveable interface
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export interface Moveable
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| -------------------------------------- | -------------------------------- |
|
||||
| [move()](./puppeteer.moveable.move.md) | Moves the resource when 'using'. |
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
sidebar_label: SecurityDetails
|
||||
---
|
||||
|
||||
# SecurityDetails class
|
||||
|
||||
The SecurityDetails class represents the security details of a response that was received over a secure connection.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class SecurityDetails
|
||||
```
|
||||
|
||||
## 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 `SecurityDetails` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ----------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [issuer()](./puppeteer.securitydetails.issuer.md) | | The name of the issuer of the certificate. |
|
||||
| [protocol()](./puppeteer.securitydetails.protocol.md) | | The security protocol being used, e.g. "TLS 1.2". |
|
||||
| [subjectAlternativeNames()](./puppeteer.securitydetails.subjectalternativenames.md) | | The list of [subject alternative names (SANs)](https://en.wikipedia.org/wiki/Subject_Alternative_Name) of the certificate. |
|
||||
| [subjectName()](./puppeteer.securitydetails.subjectname.md) | | The name of the subject to which the certificate was issued. |
|
||||
| [validFrom()](./puppeteer.securitydetails.validfrom.md) | | [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the start of the certificate's validity. |
|
||||
| [validTo()](./puppeteer.securitydetails.validto.md) | | [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the end of the certificate's validity. |
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
sidebar_label: Target
|
||||
---
|
||||
|
||||
# Target class
|
||||
|
||||
Target represents a [CDP target](https://chromedevtools.github.io/devtools-protocol/tot/Target/). In CDP a target is something that can be debugged such a frame, a page or a worker.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Target
|
||||
```
|
||||
|
||||
## 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 `Target` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [asPage()](./puppeteer.target.aspage.md) | | Forcefully creates a page for a target of any type. It is useful if you want to handle a CDP target of type <code>other</code> as a page. If you deal with a regular page target, use [Target.page()](./puppeteer.target.page.md). |
|
||||
| [browser()](./puppeteer.target.browser.md) | | Get the browser the target belongs to. |
|
||||
| [browserContext()](./puppeteer.target.browsercontext.md) | | Get the browser context the target belongs to. |
|
||||
| [createCDPSession()](./puppeteer.target.createcdpsession.md) | | Creates a Chrome Devtools Protocol session attached to the target. |
|
||||
| [opener()](./puppeteer.target.opener.md) | | Get the target that opened this target. Top-level targets return <code>null</code>. |
|
||||
| [page()](./puppeteer.target.page.md) | | If the target is not of type <code>"page"</code>, <code>"webview"</code> or <code>"background_page"</code>, returns <code>null</code>. |
|
||||
| [type()](./puppeteer.target.type.md) | | Identifies what kind of target this is. |
|
||||
| [url()](./puppeteer.target.url.md) | | |
|
||||
| [worker()](./puppeteer.target.worker.md) | | If the target is not of type <code>"service_worker"</code> or <code>"shared_worker"</code>, returns <code>null</code>. |
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
sidebar_label: Touchscreen
|
||||
---
|
||||
|
||||
# Touchscreen class
|
||||
|
||||
The Touchscreen class exposes touchscreen events.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class Touchscreen
|
||||
```
|
||||
|
||||
## 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 `Touchscreen` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------- | --------- | --------------------------------------------------------------------- |
|
||||
| [tap(x, y)](./puppeteer.touchscreen.tap.md) | | Dispatches a <code>touchstart</code> and <code>touchend</code> event. |
|
||||
| [touchEnd()](./puppeteer.touchscreen.touchend.md) | | Dispatches a <code>touchend</code> event. |
|
||||
| [touchMove(x, y)](./puppeteer.touchscreen.touchmove.md) | | Dispatches a <code>touchMove</code> event. |
|
||||
| [touchStart(x, y)](./puppeteer.touchscreen.touchstart.md) | | Dispatches a <code>touchstart</code> event. |
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
sidebar_label: CLI
|
||||
---
|
||||
|
||||
# CLI class
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class CLI
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| ---------------------------------------------------------- | --------- | ------------------------------------------------------- |
|
||||
| [(constructor)(opts, rl)](./browsers.cli._constructor_.md) | | Constructs a new instance of the <code>CLI</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------- | --------- | ----------- |
|
||||
| [run(argv)](./browsers.cli.run.md) | | |
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
sidebar_label: Process
|
||||
---
|
||||
|
||||
# Process class
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class Process
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| ---------------------------------------------------------- | --------- | ----------------------------------------------------------- |
|
||||
| [(constructor)(opts)](./browsers.process._constructor_.md) | | Constructs a new instance of the <code>Process</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ----------- | --------------------- | ------------------------- | ----------- |
|
||||
| nodeProcess | <code>readonly</code> | childProcess.ChildProcess | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------- | --------- | ----------- |
|
||||
| [close()](./browsers.process.close.md) | | |
|
||||
| [hasClosed()](./browsers.process.hasclosed.md) | | |
|
||||
| [kill()](./browsers.process.kill.md) | | |
|
||||
| [waitForLineOutput(regex, timeout)](./browsers.process.waitforlineoutput.md) | | |
|
@ -58,12 +58,12 @@ sidebar_label: API
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------------------------------------------------------------------------------------- | ----------- |
|
||||
| [clearCustomQueryHandlers()](./puppeteer.clearcustomqueryhandlers.md) | |
|
||||
| [customQueryHandlerNames()](./puppeteer.customqueryhandlernames.md) | |
|
||||
| [registerCustomQueryHandler(name, handler)](./puppeteer.registercustomqueryhandler.md) | |
|
||||
| [unregisterCustomQueryHandler(name)](./puppeteer.unregistercustomqueryhandler.md) | |
|
||||
| Function | Description |
|
||||
| --------------------------------------------------------------------------- | ----------- |
|
||||
| [clearCustomQueryHandlers](./puppeteer.clearcustomqueryhandlers.md) | |
|
||||
| [customQueryHandlerNames](./puppeteer.customqueryhandlernames.md) | |
|
||||
| [registerCustomQueryHandler](./puppeteer.registercustomqueryhandler.md) | |
|
||||
| [unregisterCustomQueryHandler](./puppeteer.unregistercustomqueryhandler.md) | |
|
||||
|
||||
## Interfaces
|
||||
|
@ -24,6 +24,6 @@ The constructor for this class is marked as internal. Third-party code should no
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [snapshot](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |
|
@ -6,7 +6,7 @@ sidebar_label: Browser.isConnected
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> Use [Browser.connected](./puppeteer.browser.connected.md).
|
||||
> Use [Browser.connected](./puppeteer.browser.md).
|
||||
|
||||
Whether Puppeteer is connected to this [browser](./puppeteer.browser.md).
|
||||
|
@ -62,20 +62,20 @@ await browser2.close();
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | <p>Gets a list of open [browser contexts](./puppeteer.browsercontext.md).</p><p>In a newly-created [browser](./puppeteer.browser.md), this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md).</p> |
|
||||
| [close()](./puppeteer.browser.close.md) | | Closes this [browser](./puppeteer.browser.md) and all associated [pages](./puppeteer.page.md). |
|
||||
| [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | <p>Creates a new incognito [browser context](./puppeteer.browsercontext.md).</p><p>This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Gets the default [browser context](./puppeteer.browsercontext.md). |
|
||||
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. |
|
||||
| [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). |
|
||||
| [newPage()](./puppeteer.browser.newpage.md) | | Creates a new [page](./puppeteer.page.md) in the [default browser context](./puppeteer.browser.defaultbrowsercontext.md). |
|
||||
| [pages()](./puppeteer.browser.pages.md) | | <p>Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).</p><p>If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [process()](./puppeteer.browser.process.md) | | Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#class-childprocess). |
|
||||
| [target()](./puppeteer.browser.target.md) | | Gets the [target](./puppeteer.target.md) associated with the [default browser context](./puppeteer.browser.defaultbrowsercontext.md)). |
|
||||
| [targets()](./puppeteer.browser.targets.md) | | <p>Gets all active [targets](./puppeteer.target.md).</p><p>In case of multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [targets](./puppeteer.target.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [userAgent()](./puppeteer.browser.useragent.md) | | <p>Gets this [browser's](./puppeteer.browser.md) original user agent.</p><p>[Pages](./puppeteer.page.md) can override the user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).</p> |
|
||||
| [version()](./puppeteer.browser.version.md) | | <p>Gets a string representing this [browser's](./puppeteer.browser.md) name and version.</p><p>For headless browser, this is similar to <code>"HeadlessChrome/61.0.3153.0"</code>. For non-headless or new-headless, this is similar to <code>"Chrome/61.0.3153.0"</code>. For Firefox, it is similar to <code>"Firefox/116.0a1"</code>.</p><p>The format of [Browser.version()](./puppeteer.browser.version.md) might change with future releases of browsers.</p> |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | <p>Waits until a [target](./puppeteer.target.md) matching the given <code>predicate</code> appears and returns it.</p><p>This will look all open [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | <p>Gets the WebSocket URL to connect to this [browser](./puppeteer.browser.md).</p><p>This is usually used with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).</p><p>You can find the debugger URL (<code>webSocketDebuggerUrl</code>) from <code>http://HOST:PORT/json/version</code>.</p><p>See [browser endpoint](https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target) for more information.</p> |
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browserContexts](./puppeteer.browser.browsercontexts.md) | | <p>Gets a list of open [browser contexts](./puppeteer.browsercontext.md).</p><p>In a newly-created [browser](./puppeteer.browser.md), this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md).</p> |
|
||||
| [close](./puppeteer.browser.close.md) | | Closes this [browser](./puppeteer.browser.md) and all associated [pages](./puppeteer.page.md). |
|
||||
| [createIncognitoBrowserContext](./puppeteer.browser.createincognitobrowsercontext.md) | | <p>Creates a new incognito [browser context](./puppeteer.browsercontext.md).</p><p>This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [defaultBrowserContext](./puppeteer.browser.defaultbrowsercontext.md) | | Gets the default [browser context](./puppeteer.browsercontext.md). |
|
||||
| [disconnect](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. |
|
||||
| [isConnected](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). |
|
||||
| [newPage](./puppeteer.browser.newpage.md) | | Creates a new [page](./puppeteer.page.md) in the [default browser context](./puppeteer.browser.defaultbrowsercontext.md). |
|
||||
| [pages](./puppeteer.browser.pages.md) | | <p>Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).</p><p>If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [process](./puppeteer.browser.process.md) | | Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#class-childprocess). |
|
||||
| [target](./puppeteer.browser.target.md) | | Gets the [target](./puppeteer.target.md) associated with the [default browser context](./puppeteer.browser.defaultbrowsercontext.md)). |
|
||||
| [targets](./puppeteer.browser.targets.md) | | <p>Gets all active [targets](./puppeteer.target.md).</p><p>In case of multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [targets](./puppeteer.target.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [userAgent](./puppeteer.browser.useragent.md) | | <p>Gets this [browser's](./puppeteer.browser.md) original user agent.</p><p>[Pages](./puppeteer.page.md) can override the user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).</p> |
|
||||
| [version](./puppeteer.browser.version.md) | | <p>Gets a string representing this [browser's](./puppeteer.browser.md) name and version.</p><p>For headless browser, this is similar to <code>"HeadlessChrome/61.0.3153.0"</code>. For non-headless or new-headless, this is similar to <code>"Chrome/61.0.3153.0"</code>. For Firefox, it is similar to <code>"Firefox/116.0a1"</code>.</p><p>The format of [Browser.version()](./puppeteer.browser.version.md) might change with future releases of browsers.</p> |
|
||||
| [waitForTarget](./puppeteer.browser.waitfortarget.md) | | <p>Waits until a [target](./puppeteer.target.md) matching the given <code>predicate</code> appears and returns it.</p><p>This will look all open [browser contexts](./puppeteer.browsercontext.md).</p> |
|
||||
| [wsEndpoint](./puppeteer.browser.wsendpoint.md) | | <p>Gets the WebSocket URL to connect to this [browser](./puppeteer.browser.md).</p><p>This is usually used with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).</p><p>You can find the debugger URL (<code>webSocketDebuggerUrl</code>) from <code>http://HOST:PORT/json/version</code>.</p><p>See [browser endpoint](https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target) for more information.</p> |
|
@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_label: BrowserContext
|
||||
---
|
||||
|
||||
# BrowserContext class
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md) represents individual sessions within a [browser](./puppeteer.browser.md).
|
||||
|
||||
When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createIncognitoBrowserContext()](./puppeteer.browser.createincognitobrowsercontext.md).
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum.
|
||||
|
||||
If a [page](./puppeteer.page.md) opens another [page](./puppeteer.page.md), e.g. using `window.open`, the popup will belong to the parent [page's browser context](./puppeteer.page.browsercontext.md).
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare abstract class BrowserContext extends EventEmitter<BrowserContextEvents>
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[BrowserContextEvents](./puppeteer.browsercontextevents.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 `BrowserContext` class.
|
||||
|
||||
## Example
|
||||
|
||||
Creating an incognito [browser context](./puppeteer.browsercontext.md):
|
||||
|
||||
```ts
|
||||
// Create a new incognito browser context
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page inside context.
|
||||
const page = await context.newPage();
|
||||
// ... do stuff with page ...
|
||||
await page.goto('https://example.com');
|
||||
// Dispose context once it's no longer needed.
|
||||
await context.close();
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------- | --------------------- | ------------------- | ------------------------------------------------------------------------ |
|
||||
| closed | <code>readonly</code> | boolean | Whether this [browser context](./puppeteer.browsercontext.md) is closed. |
|
||||
| id | <code>readonly</code> | string \| undefined | Identifier for this [browser context](./puppeteer.browsercontext.md). |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browser](./puppeteer.browsercontext.browser.md) | | Gets the [browser](./puppeteer.browser.md) associated with this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [clearPermissionOverrides](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [close](./puppeteer.browsercontext.close.md) | | Closes this [browser context](./puppeteer.browsercontext.md) and all associated [pages](./puppeteer.page.md). |
|
||||
| [isIncognito](./puppeteer.browsercontext.isincognito.md) | | <p>Whether this [browser context](./puppeteer.browsercontext.md) is incognito.</p><p>The [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context.</p> |
|
||||
| [newPage](./puppeteer.browsercontext.newpage.md) | | Creates a new [page](./puppeteer.page.md) in this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [overridePermissions](./puppeteer.browsercontext.overridepermissions.md) | | Grants this [browser context](./puppeteer.browsercontext.md) the given <code>permissions</code> within the given <code>origin</code>. |
|
||||
| [pages](./puppeteer.browsercontext.pages.md) | | Gets a list of all open [pages](./puppeteer.page.md) inside this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [targets](./puppeteer.browsercontext.targets.md) | | Gets all active [targets](./puppeteer.target.md) inside this [browser context](./puppeteer.browsercontext.md). |
|
||||
| [waitForTarget](./puppeteer.browsercontext.waitfortarget.md) | | <p>Waits until a [target](./puppeteer.target.md) matching the given <code>predicate</code> appears and returns it.</p><p>This will look all open [browser contexts](./puppeteer.browsercontext.md).</p> |
|
@ -39,9 +39,9 @@ await client.send('Animation.setPlaybackRate', {
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [connection()](./puppeteer.cdpsession.connection.md) | | |
|
||||
| [detach()](./puppeteer.cdpsession.detach.md) | | Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages. |
|
||||
| [id()](./puppeteer.cdpsession.id.md) | | Returns the session's id. |
|
||||
| [send(method, params, options)](./puppeteer.cdpsession.send.md) | | |
|
||||
| Method | Modifiers | Description |
|
||||
| -------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [connection](./puppeteer.cdpsession.connection.md) | | |
|
||||
| [detach](./puppeteer.cdpsession.detach.md) | | Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages. |
|
||||
| [id](./puppeteer.cdpsession.id.md) | | Returns the session's id. |
|
||||
| [send](./puppeteer.cdpsession.send.md) | | |
|
@ -0,0 +1,24 @@
|
||||
---
|
||||
sidebar_label: CommonEventEmitter
|
||||
---
|
||||
|
||||
# CommonEventEmitter interface
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export interface CommonEventEmitter<Events extends Record<EventType, unknown>>
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| -------------------------------------------------------------------------- | ----------- |
|
||||
| [addListener](./puppeteer.commoneventemitter.addlistener.md) | |
|
||||
| [emit](./puppeteer.commoneventemitter.emit.md) | |
|
||||
| [listenerCount](./puppeteer.commoneventemitter.listenercount.md) | |
|
||||
| [off](./puppeteer.commoneventemitter.off.md) | |
|
||||
| [on](./puppeteer.commoneventemitter.on.md) | |
|
||||
| [once](./puppeteer.commoneventemitter.once.md) | |
|
||||
| [removeAllListeners](./puppeteer.commoneventemitter.removealllisteners.md) | |
|
||||
| [removeListener](./puppeteer.commoneventemitter.removelistener.md) | |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user