mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(main): release 16.1.1 (#8769)
* chore(main): release 16.1.1 * chore: generate versioned docs Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This commit is contained in:
parent
3fad05d333
commit
a5f1078feb
@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "16.1.0"
|
||||
".": "16.1.1"
|
||||
}
|
||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@ -2,6 +2,20 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [16.1.1](https://github.com/puppeteer/puppeteer/compare/v16.1.0...v16.1.1) (2022-08-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* custom sessions should not emit targetcreated events ([#8788](https://github.com/puppeteer/puppeteer/issues/8788)) ([3fad05d](https://github.com/puppeteer/puppeteer/commit/3fad05d333b79f41a7b58582c4ca493200bb5a79)), closes [#8787](https://github.com/puppeteer/puppeteer/issues/8787)
|
||||
* deprecate `ExecutionContext` ([#8792](https://github.com/puppeteer/puppeteer/issues/8792)) ([b5da718](https://github.com/puppeteer/puppeteer/commit/b5da718e2e4a2004a36cf23cad555e1fc3b50333))
|
||||
* deprecate `root` in `WaitForSelectorOptions` ([#8795](https://github.com/puppeteer/puppeteer/issues/8795)) ([65a5ce8](https://github.com/puppeteer/puppeteer/commit/65a5ce8464c56fcc55e5ac3ed490f31311bbe32a))
|
||||
* deprecate `waitForTimeout` ([#8793](https://github.com/puppeteer/puppeteer/issues/8793)) ([8f612d5](https://github.com/puppeteer/puppeteer/commit/8f612d5ff855d48ae4b38bdaacf2a8fbda8e9ce8))
|
||||
* make sure there is a check for targets when timeout=0 ([#8765](https://github.com/puppeteer/puppeteer/issues/8765)) ([c23cdb7](https://github.com/puppeteer/puppeteer/commit/c23cdb73a7b113c1dd29f7e4a7a61326422c4080)), closes [#8763](https://github.com/puppeteer/puppeteer/issues/8763)
|
||||
* resolve navigation flakiness ([#8768](https://github.com/puppeteer/puppeteer/issues/8768)) ([2580347](https://github.com/puppeteer/puppeteer/commit/2580347b50091d172b2a5591138a2e41ede072fe)), closes [#8644](https://github.com/puppeteer/puppeteer/issues/8644)
|
||||
* specify Puppeteer version for Chromium 105.0.5173.0 ([#8766](https://github.com/puppeteer/puppeteer/issues/8766)) ([b5064b7](https://github.com/puppeteer/puppeteer/commit/b5064b7b8bd3bd9eb481b6807c65d9d06d23b9dd))
|
||||
* use targetFilter in puppeteer.launch ([#8774](https://github.com/puppeteer/puppeteer/issues/8774)) ([ee2540b](https://github.com/puppeteer/puppeteer/commit/ee2540baefeced44f6b336f2b979af5c3a4cb040)), closes [#8772](https://github.com/puppeteer/puppeteer/issues/8772)
|
||||
|
||||
## [16.1.0](https://github.com/puppeteer/puppeteer/compare/v16.0.0...v16.1.0) (2022-08-06)
|
||||
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "puppeteer",
|
||||
"version": "16.1.0",
|
||||
"version": "16.1.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "puppeteer",
|
||||
"version": "16.1.0",
|
||||
"version": "16.1.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppeteer",
|
||||
"version": "16.1.0",
|
||||
"version": "16.1.1",
|
||||
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
|
||||
"keywords": [
|
||||
"puppeteer",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const packageVersion = '16.1.0';
|
||||
export const packageVersion = '16.1.1';
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
const versionsPerRelease = new Map([
|
||||
// This is a mapping from Chromium version => Puppeteer version.
|
||||
// In Chromium roll patches, use 'NEXT' for the Puppeteer version.
|
||||
// In Chromium roll patches, use 'v16.1.1' for the Puppeteer version.
|
||||
['105.0.5173.0', 'v15.5.0'],
|
||||
['104.0.5109.0', 'v15.1.0'],
|
||||
['103.0.5059.0', 'v14.2.0'],
|
||||
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
sidebar_label: connect
|
||||
---
|
||||
|
||||
# connect variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
connect: (options: import("./types.js").ConnectOptions) => Promise<import("./types.js").Browser>
|
||||
```
|
@ -1,57 +0,0 @@
|
||||
---
|
||||
sidebar_label: ElementHandle.$$eval
|
||||
---
|
||||
|
||||
# ElementHandle.$$eval() method
|
||||
|
||||
This method runs `document.querySelectorAll` within the element and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
|
||||
|
||||
If `pageFunction` returns a Promise, then `frame.$$eval` would wait for the promise to resolve and return its value.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class ElementHandle {
|
||||
$$eval<
|
||||
Selector extends string,
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<
|
||||
[Array<NodeFor<Selector>>, ...Params]
|
||||
> = EvaluateFunc<[Array<NodeFor<Selector>>, ...Params]>
|
||||
>(
|
||||
selector: Selector,
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<Awaited<ReturnType<Func>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | ----------- |
|
||||
| selector | Selector | |
|
||||
| pageFunction | Func \| string | |
|
||||
| args | Params | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Example 1
|
||||
|
||||
```html
|
||||
<div class="feed">
|
||||
<div class="tweet">Hello!</div>
|
||||
<div class="tweet">Hi!</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
```ts
|
||||
const feedHandle = await page.$('.feed');
|
||||
expect(
|
||||
await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))
|
||||
).toEqual(['Hello!', 'Hi!']);
|
||||
```
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
sidebar_label: ElementHandle.$eval
|
||||
---
|
||||
|
||||
# ElementHandle.$eval() method
|
||||
|
||||
This method runs `document.querySelector` within the element and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
|
||||
|
||||
If `pageFunction` returns a Promise, then `frame.$eval` would wait for the promise to resolve and return its value.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class ElementHandle {
|
||||
$eval<
|
||||
Selector extends string,
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<
|
||||
[ElementHandle<NodeFor<Selector>>, ...Params]
|
||||
> = EvaluateFunc<[ElementHandle<NodeFor<Selector>>, ...Params]>
|
||||
>(
|
||||
selector: Selector,
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<Awaited<ReturnType<Func>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | ----------- |
|
||||
| selector | Selector | |
|
||||
| pageFunction | Func \| string | |
|
||||
| args | Params | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const tweetHandle = await page.$('.tweet');
|
||||
expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');
|
||||
expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
|
||||
```
|
@ -1,43 +0,0 @@
|
||||
---
|
||||
sidebar_label: ElementHandle.waitForSelector
|
||||
---
|
||||
|
||||
# ElementHandle.waitForSelector() method
|
||||
|
||||
Wait for the `selector` to appear within the element. 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.
|
||||
|
||||
This method does not work across navigations or if the element is detached from DOM.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class ElementHandle {
|
||||
waitForSelector<Selector extends string>(
|
||||
selector: Selector,
|
||||
options?: Exclude<WaitForSelectorOptions, 'root'>
|
||||
): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
||||
| selector | Selector | A [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) of an element to wait for |
|
||||
| options | Exclude<[WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md), 'root'> | <i>(Optional)</i> Optional waiting parameters |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[ElementHandle](./puppeteer.elementhandle.md)<[NodeFor](./puppeteer.nodefor.md)<Selector>> \| null>
|
||||
|
||||
Promise which resolves when element specified by selector string is added to DOM. Resolves to `null` if waiting for hidden: `true` and selector is not found in DOM.
|
||||
|
||||
## Remarks
|
||||
|
||||
The optional parameters in `options` are:
|
||||
|
||||
- `visible`: wait for the selected element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
|
||||
|
||||
- `hidden`: wait for the selected element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
|
||||
|
||||
- `timeout`: maximum time to wait in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.
|
@ -1,65 +0,0 @@
|
||||
---
|
||||
sidebar_label: ExecutionContext.evaluateHandle
|
||||
---
|
||||
|
||||
# ExecutionContext.evaluateHandle() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class ExecutionContext {
|
||||
evaluateHandle<
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
||||
>(
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | --------------------------------------------------------------- |
|
||||
| pageFunction | Func \| string | a function to be evaluated in the <code>executionContext</code> |
|
||||
| args | Params | argument to pass to the page function |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[HandleFor](./puppeteer.handlefor.md)<Awaited<ReturnType<Func>>>>
|
||||
|
||||
A promise that resolves to the return value of the given function as an in-page object (a [JSHandle](./puppeteer.jshandle.md)).
|
||||
|
||||
## Remarks
|
||||
|
||||
The only difference between `executionContext.evaluate` and `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` returns an in-page object (a [JSHandle](./puppeteer.jshandle.md)). If the function passed to the `executionContext.evaluateHandle` returns a Promise, then `executionContext.evaluateHandle` would wait for the promise to resolve and return its value.
|
||||
|
||||
## Example 1
|
||||
|
||||
```ts
|
||||
const context = await page.mainFrame().executionContext();
|
||||
const aHandle = await context.evaluateHandle(() => Promise.resolve(self));
|
||||
aHandle; // Handle for the global object.
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
A string can also be passed in instead of a function.
|
||||
|
||||
```ts
|
||||
// Handle for the '3' * object.
|
||||
const aHandle = await context.evaluateHandle('1 + 2');
|
||||
```
|
||||
|
||||
## Example 3
|
||||
|
||||
JSHandle instances can be passed as arguments to the `executionContext.* evaluateHandle`:
|
||||
|
||||
```ts
|
||||
const aHandle = await context.evaluateHandle(() => document.body);
|
||||
const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle);
|
||||
console.log(await resultHandle.jsonValue()); // prints body's innerHTML
|
||||
await aHandle.dispose();
|
||||
await resultHandle.dispose();
|
||||
```
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
sidebar_label: ExecutionContext
|
||||
---
|
||||
|
||||
# ExecutionContext class
|
||||
|
||||
This class represents a context for JavaScript execution. A \[Page\] might have many execution contexts: - each [frame](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) has "default" execution context that is always created after frame is attached to DOM. This context is returned by the [Frame.executionContext()](./puppeteer.frame.executioncontext.md) method. - [Extension](https://developer.chrome.com/extensions)'s content scripts create additional execution contexts.
|
||||
|
||||
Besides pages, execution contexts can be found in [workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class ExecutionContext
|
||||
```
|
||||
|
||||
## 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 `ExecutionContext` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------------------------------ | --------- | -------------------------------------------------------------------------------------------- |
|
||||
| [evaluate(pageFunction, args)](./puppeteer.executioncontext.evaluate.md) | | |
|
||||
| [evaluateHandle(pageFunction, args)](./puppeteer.executioncontext.evaluatehandle.md) | | |
|
||||
| [frame()](./puppeteer.executioncontext.frame.md) | | |
|
||||
| [queryObjects(prototypeHandle)](./puppeteer.executioncontext.queryobjects.md) | | This method iterates the JavaScript heap and finds all the objects with the given prototype. |
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.$$eval
|
||||
---
|
||||
|
||||
# Frame.$$eval() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
$$eval<
|
||||
Selector extends string,
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<
|
||||
[Array<NodeFor<Selector>>, ...Params]
|
||||
> = EvaluateFunc<[Array<NodeFor<Selector>>, ...Params]>
|
||||
>(
|
||||
selector: Selector,
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<Awaited<ReturnType<Func>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | --------------------------------------------------------- |
|
||||
| selector | Selector | the selector to query for |
|
||||
| pageFunction | Func \| string | the function to be evaluated in the frame's context |
|
||||
| args | Params | additional arguments to pass to <code>pageFunction</code> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Remarks
|
||||
|
||||
This method runs `Array.from(document.querySelectorAll(selector))` within the frame and passes it as the first argument to `pageFunction`.
|
||||
|
||||
If `pageFunction` returns a Promise, then `frame.$$eval` would wait for the promise to resolve and return its value.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const divsCounts = await frame.$$eval('div', divs => divs.length);
|
||||
```
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.$eval
|
||||
---
|
||||
|
||||
# Frame.$eval() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
$eval<
|
||||
Selector extends string,
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<
|
||||
[ElementHandle<NodeFor<Selector>>, ...Params]
|
||||
> = EvaluateFunc<[ElementHandle<NodeFor<Selector>>, ...Params]>
|
||||
>(
|
||||
selector: Selector,
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<Awaited<ReturnType<Func>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | --------------------------------------------------------- |
|
||||
| selector | Selector | the selector to query for |
|
||||
| pageFunction | Func \| string | the function to be evaluated in the frame's context |
|
||||
| args | Params | additional arguments to pass to <code>pageFunction</code> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Remarks
|
||||
|
||||
This method runs `document.querySelector` within the frame and passes it as the first argument to `pageFunction`.
|
||||
|
||||
If `pageFunction` returns a Promise, then `frame.$eval` would wait for the promise to resolve and return its value.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const searchValue = await frame.$eval('#search', el => el.value);
|
||||
```
|
@ -1,46 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.click
|
||||
---
|
||||
|
||||
# Frame.click() method
|
||||
|
||||
This method clicks the first element found that matches `selector`.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
click(
|
||||
selector: string,
|
||||
options?: {
|
||||
delay?: number;
|
||||
button?: MouseButton;
|
||||
clickCount?: number;
|
||||
}
|
||||
): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
||||
| selector | string | the selector to search for to click. If there are multiple elements, the first will be clicked. |
|
||||
| options | { delay?: number; button?: [MouseButton](./puppeteer.mousebutton.md); clickCount?: number; } | <i>(Optional)</i> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Remarks
|
||||
|
||||
This method scrolls the element into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to click in the center of the element. If there's no element matching `selector`, the method throws an error.
|
||||
|
||||
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
|
||||
|
||||
```javascript
|
||||
const [response] = await Promise.all([
|
||||
page.waitForNavigation(waitOptions),
|
||||
frame.click(selector, clickOptions),
|
||||
]);
|
||||
```
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.evaluate
|
||||
---
|
||||
|
||||
# Frame.evaluate() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
evaluate<
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
||||
>(
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<Awaited<ReturnType<Func>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | ------------------------------------------ |
|
||||
| pageFunction | Func \| string | a function that is run within the frame |
|
||||
| args | Params | arguments to be passed to the pageFunction |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Remarks
|
||||
|
||||
This method behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it's run within the context of the `frame`, rather than the entire page.
|
@ -1,36 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.evaluateHandle
|
||||
---
|
||||
|
||||
# Frame.evaluateHandle() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
evaluateHandle<
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
||||
>(
|
||||
pageFunction: Func | string,
|
||||
...args: Params
|
||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ------------ | -------------- | ------------------------------------------ |
|
||||
| pageFunction | Func \| string | a function that is run within the frame |
|
||||
| args | Params | arguments to be passed to the pageFunction |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[HandleFor](./puppeteer.handlefor.md)<Awaited<ReturnType<Func>>>>
|
||||
|
||||
## Remarks
|
||||
|
||||
The only difference between [Frame.evaluate()](./puppeteer.frame.evaluate.md) and `frame.evaluateHandle` is that `evaluateHandle` will return the value wrapped in an in-page object.
|
||||
|
||||
This method behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md) except it's run within the context of the `frame`, rather than the entire page.
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.focus
|
||||
---
|
||||
|
||||
# Frame.focus() method
|
||||
|
||||
This method fetches an element with `selector` and focuses it.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
focus(selector: string): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | ------------------------------------------------------------------------------------------------- |
|
||||
| selector | string | the selector for the element to focus. If there are multiple elements, the first will be focused. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Remarks
|
||||
|
||||
If there's no element matching `selector`, the method throws an error.
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.hover
|
||||
---
|
||||
|
||||
# Frame.hover() method
|
||||
|
||||
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to hover over the center of the element.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
hover(selector: string): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | ------------------------------------------------------------------------------------------------- |
|
||||
| selector | string | the selector for the element to hover. If there are multiple elements, the first will be hovered. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Remarks
|
||||
|
||||
If there's no element matching `selector`, the method throws an
|
@ -1,25 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.name
|
||||
---
|
||||
|
||||
# Frame.name() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
name(): string;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
string
|
||||
|
||||
the frame's `name` attribute as specified in the tag.
|
||||
|
||||
## Remarks
|
||||
|
||||
If the name is empty, it returns the `id` attribute instead.
|
||||
|
||||
Note: This value is calculated once when the frame is created, and will not update if the attribute is changed later.
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
sidebar_label: Frame.tap
|
||||
---
|
||||
|
||||
# Frame.tap() method
|
||||
|
||||
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.touchscreen.md) to tap in the center of the element.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
tap(selector: string): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | -------------------- |
|
||||
| selector | string | the selector to tap. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
a promise that resolves when the element has been tapped.
|
||||
|
||||
## Remarks
|
||||
|
||||
If there's no element matching `selector`, the method throws an error.
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
sidebar_label: JSHandle.jsonValue
|
||||
---
|
||||
|
||||
# JSHandle.jsonValue() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class JSHandle {
|
||||
jsonValue<T = unknown>(): Promise<T>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<T>
|
||||
|
||||
Returns a JSON representation of the object.If the object has a `toJSON` function, it will not be called.
|
||||
|
||||
## Remarks
|
||||
|
||||
The JSON is generated by running [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) on the object in page and consequent [JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) in puppeteer. \*\*NOTE\*\* The method throws if the referenced object is not stringifiable.
|
@ -1,49 +0,0 @@
|
||||
---
|
||||
sidebar_label: JSHandle
|
||||
---
|
||||
|
||||
# JSHandle class
|
||||
|
||||
Represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle](./puppeteer.page.evaluatehandle.md) method.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare 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);
|
||||
```
|
||||
|
||||
JSHandle prevents the referenced JavaScript object from being garbage-collected unless the handle is [disposed](./puppeteer.jshandle.dispose.md). JSHandles are auto- disposed when their origin frame gets navigated or the parent context gets destroyed.
|
||||
|
||||
JSHandle instances can be used as arguments for [Page.$eval()](./puppeteer.page._eval.md), [Page.evaluate()](./puppeteer.page.evaluate.md), and [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md).
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --------------------------------------------------------------------- | --------- | ---- | -------------------------------------------------------------------------------- |
|
||||
| [\[\_\_JSHandleSymbol\]?](./puppeteer.jshandle.___jshandlesymbol_.md) | | T | <i>(Optional)</i> Used for nominally typing [JSHandle](./puppeteer.jshandle.md). |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [asElement()](./puppeteer.jshandle.aselement.md) | | |
|
||||
| [dispose()](./puppeteer.jshandle.dispose.md) | | Stops referencing the element handle, and resolves when the object handle is successfully disposed of. |
|
||||
| [evaluate(pageFunction, args)](./puppeteer.jshandle.evaluate.md) | | This method passes this handle as the first argument to <code>pageFunction</code>. If <code>pageFunction</code> returns a Promise, then <code>handle.evaluate</code> would wait for the promise to resolve and return its value. |
|
||||
| [evaluateHandle(pageFunction, args)](./puppeteer.jshandle.evaluatehandle.md) | | This method passes this handle as the first argument to <code>pageFunction</code>. |
|
||||
| [executionContext()](./puppeteer.jshandle.executioncontext.md) | | Returns the execution context the handle belongs to. |
|
||||
| [getProperties()](./puppeteer.jshandle.getproperties.md) | | The method returns a map with property names as keys and JSHandle instances for the property values. |
|
||||
| [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) | | |
|
||||
| [remoteObject()](./puppeteer.jshandle.remoteobject.md) | | Provides access to \[Protocol.Runtime.RemoteObject\](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/\#type-RemoteObject) backing this JSHandle. |
|
||||
| [toString()](./puppeteer.jshandle.tostring.md) | | Returns a string representation of the JSHandle. |
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
sidebar_label: launch
|
||||
---
|
||||
|
||||
# launch variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
launch: (options?: import("./types.js").PuppeteerLaunchOptions) => Promise<import("./types.js").Browser>
|
||||
```
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
sidebar_label: WaitForSelectorOptions
|
||||
---
|
||||
|
||||
# WaitForSelectorOptions interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface WaitForSelectorOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --------------------------------------------------------- | --------- | --------------------------------------------------------- | ----------------- |
|
||||
| [hidden?](./puppeteer.waitforselectoroptions.hidden.md) | | boolean | <i>(Optional)</i> |
|
||||
| [root?](./puppeteer.waitforselectoroptions.root.md) | | [ElementHandle](./puppeteer.elementhandle.md)<Node> | <i>(Optional)</i> |
|
||||
| [timeout?](./puppeteer.waitforselectoroptions.timeout.md) | | number | <i>(Optional)</i> |
|
||||
| [visible?](./puppeteer.waitforselectoroptions.visible.md) | | boolean | <i>(Optional)</i> |
|
@ -7,7 +7,7 @@ sidebar_label: API
|
||||
## Classes
|
||||
|
||||
| Class | Description |
|
||||
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium'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). |
|
||||
| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a Chromium instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
||||
| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. |
|
||||
@ -21,13 +21,13 @@ sidebar_label: API
|
||||
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
|
||||
| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. |
|
||||
| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. |
|
||||
| [ExecutionContext](./puppeteer.executioncontext.md) | <p>This class represents a context for JavaScript execution. A \[Page\] might have many execution contexts: - each [frame](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) has "default" execution context that is always created after frame is attached to DOM. This context is returned by the [Frame.executionContext()](./puppeteer.frame.executioncontext.md) method. - [Extension](https://developer.chrome.com/extensions)'s content scripts create additional execution contexts.</p><p>Besides pages, execution contexts can be found in [workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).</p> |
|
||||
| [ExecutionContext](./puppeteer.executioncontext.md) | |
|
||||
| [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. |
|
||||
| [Frame](./puppeteer.frame.md) | At every point of time, page exposes its current frame tree via the [page.mainFrame](./puppeteer.page.mainframe.md) and [frame.childFrames](./puppeteer.frame.childframes.md) methods. |
|
||||
| [Frame](./puppeteer.frame.md) | <p>Represents a DOM frame.</p><p>To understand frames, you can think of frames as <code><iframe></code> 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.</p> |
|
||||
| [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. |
|
||||
| [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. |
|
||||
| [JSCoverage](./puppeteer.jscoverage.md) | |
|
||||
| [JSHandle](./puppeteer.jshandle.md) | Represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle](./puppeteer.page.evaluatehandle.md) method. |
|
||||
| [JSHandle](./puppeteer.jshandle.md) | <p>Represents a reference to a JavaScript object. Instances can be created using [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md).</p><p>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.</p><p>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.</p> |
|
||||
| [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](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. |
|
||||
| [Page](./puppeteer.page.md) | <p>Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium.</p><p>:::note</p><p>One Browser instance might have multiple Page instances.</p><p>:::</p> |
|
||||
@ -39,7 +39,7 @@ sidebar_label: API
|
||||
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
||||
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
||||
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. |
|
||||
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
|
||||
| [WebWorker](./puppeteer.webworker.md) | This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
|
||||
|
||||
## Enumerations
|
||||
|
@ -28,7 +28,7 @@ An AXNode object representing the snapshot.
|
||||
|
||||
## Remarks
|
||||
|
||||
\*\*NOTE\*\* The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
||||
**NOTE** The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
||||
|
||||
## Example 1
|
||||
|
@ -30,7 +30,7 @@ const browser = await puppeteer.launch({
|
||||
});
|
||||
```
|
||||
|
||||
\*\*NOTE\*\* BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
|
||||
**NOTE** BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
|
||||
|
||||
## Methods
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user