2020-12-30 18:04:51 -08:00
|
|
|
<!-- THIS FILE IS NOW GENERATED -->
|
|
|
|
|
2020-04-16 10:27:31 -07:00
|
|
|
# Core concepts
|
|
|
|
|
|
|
|
Playwright provides a set of APIs to automate Chromium, Firefox and WebKit
|
|
|
|
browsers. By using the Playwright API, you can write JavaScript code to create
|
|
|
|
new browser pages, navigate to URLs and then interact with elements on a page.
|
|
|
|
|
|
|
|
Along with a test runner Playwright can be used to automate user interactions to
|
2020-12-30 18:04:51 -08:00
|
|
|
validate and test web applications. The Playwright API enables this through the
|
|
|
|
following primitives.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-05-11 09:54:03 -07:00
|
|
|
<!-- GEN:toc-top-level -->
|
|
|
|
- [Browser](#browser)
|
|
|
|
- [Browser contexts](#browser-contexts)
|
|
|
|
- [Pages and frames](#pages-and-frames)
|
|
|
|
- [Selectors](#selectors)
|
|
|
|
- [Auto-waiting](#auto-waiting)
|
2020-06-22 16:53:56 -07:00
|
|
|
- [Execution contexts: Node.js and Browser](#execution-contexts-nodejs-and-browser)
|
|
|
|
- [Object & Element handles](#object--element-handles)
|
2020-05-11 09:54:03 -07:00
|
|
|
<!-- GEN:stop -->
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
## Browser
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
A [Browser] refers to an instance of Chromium, Firefox or WebKit. Playwright
|
|
|
|
scripts generally start with launching a browser instance and end with closing
|
|
|
|
the browser. Browser instances can be launched in headless (without a GUI) or
|
|
|
|
headful mode.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
|
|
|
|
|
|
|
const browser = await chromium.launch({ headless: false });
|
|
|
|
await browser.close();
|
|
|
|
```
|
|
|
|
|
|
|
|
Launching a browser instance can be expensive, and Playwright is designed to
|
|
|
|
maximize what a single instance can do through multiple browser contexts.
|
|
|
|
|
2020-04-19 19:42:40 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [Browser]
|
2020-04-19 19:42:40 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
## Browser contexts
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
A [BrowserContext] is an isolated incognito-alike session within a browser
|
|
|
|
instance. Browser contexts are fast and cheap to create. Browser contexts can be
|
|
|
|
used to parallelize isolated test executions.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
const browser = await chromium.launch();
|
|
|
|
const context = await browser.newContext();
|
|
|
|
```
|
|
|
|
|
|
|
|
Browser contexts can also be used to emulate multi-page scenarios involving
|
2020-04-20 14:04:49 -07:00
|
|
|
mobile devices, permissions, locale and color scheme.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
const { devices } = require('playwright');
|
|
|
|
const iPhone = devices['iPhone 11 Pro'];
|
|
|
|
|
|
|
|
const context = await browser.newContext({
|
|
|
|
...iPhone,
|
|
|
|
permissions: ['geolocation'],
|
|
|
|
geolocation: { latitude: 52.52, longitude: 13.39},
|
|
|
|
colorScheme: 'dark',
|
|
|
|
locale: 'de-DE'
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2020-04-19 19:42:40 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [BrowserContext]
|
2020-06-29 15:46:33 -07:00
|
|
|
- [browser.newContext([options])](./api.md#browsernewcontextoptions)
|
2020-04-19 19:42:40 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
## Pages and frames
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
A Browser context can have multiple pages. A [Page] refers to a single tab or a
|
|
|
|
popup window within a browser context. It should be used to navigate to URLs and
|
|
|
|
interact with the page content.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-20 14:04:49 -07:00
|
|
|
// Create a page.
|
2020-04-16 10:27:31 -07:00
|
|
|
const page = await context.newPage();
|
2020-04-20 14:04:49 -07:00
|
|
|
|
|
|
|
// Navigate explicitly, similar to entering a URL in the browser.
|
2020-04-16 10:27:31 -07:00
|
|
|
await page.goto('http://example.com');
|
2020-04-20 14:04:49 -07:00
|
|
|
// Fill an input.
|
|
|
|
await page.fill('#search', 'query');
|
|
|
|
|
|
|
|
// Navigate implicitly by clicking a link.
|
2020-04-16 10:27:31 -07:00
|
|
|
await page.click('#submit');
|
2020-04-20 14:04:49 -07:00
|
|
|
// Expect a new url.
|
|
|
|
console.log(page.url());
|
|
|
|
|
|
|
|
// Page can navigate from the script - this will be picked up by Playwright.
|
|
|
|
window.location.href = 'https://example.com';
|
2020-04-16 10:27:31 -07:00
|
|
|
```
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
> Read more on [page navigation and loading](./navigations.md).
|
2020-06-26 17:49:03 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
A page can have one or more [Frame] objects attached to it. Each page has a main
|
|
|
|
frame and page-level interactions (like `click`) are assumed to operate in the
|
|
|
|
main frame.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
A page can have additional frames attached with the `iframe` HTML tag. These
|
|
|
|
frames can be accessed for interactions inside the frame.
|
|
|
|
|
|
|
|
```js
|
2020-06-26 17:49:03 -07:00
|
|
|
// Get frame using the frame's name attribute
|
2020-04-19 19:06:23 -07:00
|
|
|
const frame = page.frame('frame-login');
|
2020-06-26 17:49:03 -07:00
|
|
|
|
|
|
|
// Get frame using frame's URL
|
|
|
|
const frame = page.frame({ url: /.*domain.*/ });
|
|
|
|
|
|
|
|
// Get frame using any other selector
|
|
|
|
const frameElementHandle = await page.$('.frame-class');
|
|
|
|
const frame = await frameElementHandle.contentFrame();
|
|
|
|
|
|
|
|
// Interact with the frame
|
2020-04-19 19:06:23 -07:00
|
|
|
await frame.fill('#username-input', 'John');
|
2020-04-16 10:27:31 -07:00
|
|
|
```
|
|
|
|
|
2020-04-19 19:42:40 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [Page]
|
|
|
|
- [Frame]
|
|
|
|
- [page.frame(frameSelector)](./api.md#pageframeframeselector)
|
2020-04-20 14:04:49 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
## Selectors
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright can search for elements using CSS selectors, XPath selectors, HTML
|
|
|
|
attributes like `id`, `data-test-id` and even text content.
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
You can explicitly specify the selector engine you are using or let Playwright
|
|
|
|
detect it.
|
2020-04-20 10:38:25 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
All selector engines except for XPath pierce shadow DOM by default. If you want
|
|
|
|
to enforce regular DOM selection, you can use the `*:light` versions of the
|
|
|
|
selectors. You don't typically need to though.
|
2020-04-20 10:38:25 -07:00
|
|
|
|
|
|
|
Learn more about selectors and selector engines [here](./selectors.md).
|
|
|
|
|
|
|
|
Some examples below:
|
|
|
|
|
|
|
|
```js
|
|
|
|
// Using data-test-id= selector engine
|
|
|
|
await page.click('data-test-id=foo');
|
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-20 10:38:25 -07:00
|
|
|
// CSS and XPath selector engines are automatically detected
|
2020-04-19 19:06:23 -07:00
|
|
|
await page.click('div');
|
2020-04-20 10:38:25 -07:00
|
|
|
await page.click('//html/body/div');
|
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-04-20 10:38:25 -07:00
|
|
|
```js
|
|
|
|
// Find node by text substring
|
|
|
|
await page.click('text=Hello w');
|
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-04-20 10:38:25 -07:00
|
|
|
```js
|
|
|
|
// Explicit CSS and XPath notation
|
|
|
|
await page.click('css=div');
|
2020-04-19 19:06:23 -07:00
|
|
|
await page.click('xpath=//html/body/div');
|
2020-04-20 10:38:25 -07:00
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-04-20 10:38:25 -07:00
|
|
|
```js
|
|
|
|
// Only search light DOM, outside WebComponent shadow DOM:
|
|
|
|
await page.click('css:light=div');
|
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Selectors using the same or different engines can be combined using the `>>`
|
|
|
|
separator. For example,
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-04-20 10:38:25 -07:00
|
|
|
```js
|
2020-04-27 10:14:09 -07:00
|
|
|
// Click an element with text 'Sign Up' inside of a #free-month-promo.
|
|
|
|
await page.click('#free-month-promo >> text=Sign Up');
|
|
|
|
```
|
|
|
|
|
|
|
|
```js
|
|
|
|
// Capture textContent of a section that contains an element with text 'Selectors'.
|
|
|
|
const sectionText = await page.$eval('*css=section >> text=Selectors', e => e.textContent);
|
2020-04-20 10:38:25 -07:00
|
|
|
```
|
2020-04-19 19:06:23 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
## Auto-waiting
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Actions like `click` and `fill` auto-wait for the element to be visible and
|
|
|
|
[actionable](./actionability.md). For example, click will:
|
2020-04-29 14:18:01 -07:00
|
|
|
- wait for an element with the given selector to appear in the DOM
|
2020-12-30 18:04:51 -08:00
|
|
|
- wait for it to become visible: have non-empty bounding box and no
|
|
|
|
`visibility:hidden`
|
2020-04-29 14:18:01 -07:00
|
|
|
- wait for it to stop moving: for example, wait until css transition finishes
|
2020-04-19 19:06:23 -07:00
|
|
|
- scroll the element into view
|
2020-12-30 18:04:51 -08:00
|
|
|
- wait for it to receive pointer events at the action point: for example, wait
|
|
|
|
until element becomes non-obscured by other elements
|
2020-04-27 15:40:46 -07:00
|
|
|
- retry if the element is detached during any of the above checks
|
2020-04-19 19:06:23 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-29 14:18:01 -07:00
|
|
|
// Playwright waits for #search element to be in the DOM
|
2020-04-19 19:06:23 -07:00
|
|
|
await page.fill('#search', 'query');
|
2020-04-20 10:38:25 -07:00
|
|
|
```
|
2020-12-30 18:04:51 -08:00
|
|
|
|
2020-04-20 10:38:25 -07:00
|
|
|
```js
|
|
|
|
// Playwright waits for element to stop animating
|
|
|
|
// and accept clicks.
|
2020-04-19 19:06:23 -07:00
|
|
|
await page.click('#search');
|
|
|
|
```
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
You can explicitly wait for an element to appear in the DOM or to become
|
|
|
|
visible:
|
2020-04-20 10:38:25 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-29 14:18:01 -07:00
|
|
|
// Wait for #search to appear in the DOM.
|
2020-05-04 11:03:44 -07:00
|
|
|
await page.waitForSelector('#search', { state: 'attached' });
|
2020-04-29 14:18:01 -07:00
|
|
|
// Wait for #promo to become visible, for example with `visibility:visible`.
|
2020-05-04 11:03:44 -07:00
|
|
|
await page.waitForSelector('#promo');
|
2020-04-20 10:38:25 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
... or to become hidden or detached
|
|
|
|
|
|
|
|
```js
|
2020-04-29 14:18:01 -07:00
|
|
|
// Wait for #details to become hidden, for example with `display:none`.
|
2020-05-04 11:03:44 -07:00
|
|
|
await page.waitForSelector('#details', { state: 'hidden' });
|
2020-04-29 14:18:01 -07:00
|
|
|
// Wait for #promo to be removed from the DOM.
|
2020-05-04 11:03:44 -07:00
|
|
|
await page.waitForSelector('#promo', { state: 'detached' });
|
2020-04-20 10:38:25 -07:00
|
|
|
```
|
|
|
|
|
2020-04-19 19:42:40 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [page.click(selector[, options])](./api.md#pageclickselector-options)
|
|
|
|
- [page.fill(selector, value[, options])](./api.md#pagefillselector-value-options)
|
|
|
|
- [page.waitForSelector(selector[, options])](./api.md#pagewaitforselectorselector-options)
|
2020-04-19 19:42:40 -07:00
|
|
|
|
2020-04-19 18:47:36 -07:00
|
|
|
<br/>
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
## Execution contexts: Node.js and Browser
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright scripts run in your Node.js environment. Your page scripts run in the
|
|
|
|
browser page environment. Those environments don't intersect, they are running
|
|
|
|
in different virtual machines in different processes and even potentially on
|
|
|
|
different computers.
|
2020-04-16 10:27:31 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
The [page.evaluate(pageFunction[, arg])](./api.md#pageevaluatepagefunction-arg)
|
|
|
|
API can run a JavaScript function in the context of the web page and bring
|
|
|
|
results back to the Node.js environment. Browser globals like `window` and
|
|
|
|
`document` can be used in `evaluate`.
|
2020-06-22 16:53:56 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
const href = await page.evaluate(() => document.location.href);
|
|
|
|
```
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
If the result is a Promise or if the function is asynchronous evaluate will
|
|
|
|
automatically wait until it's resolved:
|
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
```js
|
|
|
|
const status = await page.evaluate(async () => {
|
|
|
|
const response = await fetch(location.href);
|
|
|
|
return response.status;
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
### Evaluation
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Functions passed inside
|
|
|
|
[page.evaluate(pageFunction[, arg])](./api.md#pageevaluatepagefunction-arg) can
|
|
|
|
accept parameters. These parameters are serialized and sent into your web page
|
|
|
|
over the wire. You can pass primitive types, JSON-alike objects and remote
|
|
|
|
object handles received from the page.
|
2020-04-16 11:10:11 -07:00
|
|
|
|
|
|
|
Right:
|
2020-04-16 10:27:31 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-16 11:10:11 -07:00
|
|
|
const data = { text: 'some data', value: 1 };
|
|
|
|
// Pass |data| as a parameter.
|
|
|
|
const result = await page.evaluate(data => {
|
|
|
|
window.myApp.use(data);
|
|
|
|
}, data);
|
|
|
|
```
|
|
|
|
|
|
|
|
Wrong:
|
|
|
|
|
|
|
|
```js
|
|
|
|
const data = { text: 'some data', value: 1 };
|
2020-04-16 10:27:31 -07:00
|
|
|
const result = await page.evaluate(() => {
|
2020-04-16 11:10:11 -07:00
|
|
|
// There is no |data| in the web page.
|
|
|
|
window.myApp.use(data);
|
|
|
|
});
|
2020-04-16 10:27:31 -07:00
|
|
|
```
|
2020-04-16 11:10:11 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [page.evaluate(pageFunction[, arg])](./api.md#pageevaluatepagefunction-arg)
|
|
|
|
- [frame.evaluate(pageFunction[, arg])](./api.md#frameevaluatepagefunction-arg)
|
|
|
|
- [EvaluationArgument]
|
2020-04-19 18:47:36 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
<br/>
|
2020-04-19 18:47:36 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
## Object & Element handles
|
2020-04-20 09:46:36 -07:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright can create Node-side handles to the page DOM elements or any other
|
|
|
|
objects inside the page. These handles live in the Node.js process, whereas the
|
|
|
|
actual objects reside in browser.
|
2020-04-20 09:46:36 -07:00
|
|
|
|
|
|
|
There are two types of handles:
|
2020-12-30 18:04:51 -08:00
|
|
|
- [JSHandle] to reference any JavaScript objects in the page
|
|
|
|
- [ElementHandle] to reference DOM elements in the page
|
2020-04-20 09:46:36 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
Note that since any DOM element in the page is also a JavaScript object,
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright's [ElementHandle] extends [JSHandle].
|
2020-04-20 09:46:36 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
### Handles Lifecycle
|
2020-12-30 18:04:51 -08:00
|
|
|
- Handles can be acquired using the page methods
|
|
|
|
[page.evaluateHandle(pageFunction[, arg])](./api.md#pageevaluatehandlepagefunction-arg),
|
|
|
|
[page.$(selector)](./api.md#pageselector) or
|
|
|
|
[page.$$(selector)](./api.md#pageselector-1) or their frame counterparts
|
|
|
|
[frame.evaluateHandle(pageFunction[, arg])](./api.md#frameevaluatehandlepagefunction-arg),
|
|
|
|
[frame.$(selector)](./api.md#frameselector) or
|
|
|
|
[frame.$$(selector)](./api.md#frameselector-1).
|
|
|
|
- Once created, handles will retain object from
|
|
|
|
[garbage collection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management).
|
|
|
|
- Handles will be **automatically disposed** once the page or frame they
|
|
|
|
belong to navigates or closes.
|
|
|
|
- Handles can be **manually disposed** using
|
|
|
|
[jsHandle.dispose()](./api.md#jshandledispose) method.
|
2020-04-20 09:46:36 -07:00
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
### Example: ElementHandle
|
2020-04-20 09:46:36 -07:00
|
|
|
|
|
|
|
```js
|
2020-04-20 09:53:48 -07:00
|
|
|
// The first parameter of the elementHandle.evaluate callback is the element handle points to.
|
|
|
|
const ulElementHandle = await page.$('ul');
|
|
|
|
await ulElementHandle.evaluate(ulElement => getComputedStyle(ulElement).getPropertyValue('display'));
|
2020-04-20 09:46:36 -07:00
|
|
|
```
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Handles can also be passed as arguments to
|
|
|
|
[page.evaluate(pageFunction[, arg])](./api.md#pageevaluatepagefunction-arg)
|
|
|
|
function:
|
2020-04-20 09:53:48 -07:00
|
|
|
|
2020-04-20 09:46:36 -07:00
|
|
|
```js
|
2020-04-20 09:53:48 -07:00
|
|
|
// In the page API, you can pass handle as a parameter.
|
|
|
|
const ulElementHandle = await page.$('ul');
|
|
|
|
await page.evaluate(uiElement => getComputedStyle(uiElement).getPropertyValue('display'), uiElement);
|
2020-04-20 09:46:36 -07:00
|
|
|
```
|
|
|
|
|
2020-06-22 16:53:56 -07:00
|
|
|
### Example: JSHandle
|
|
|
|
|
|
|
|
```js
|
|
|
|
// Create a new array in the page, write a reference to it in
|
|
|
|
// window.myArray and get a handle to it.
|
|
|
|
const myArrayHandle = await page.evaluateHandle(() => {
|
|
|
|
window.myArray = [1];
|
|
|
|
return myArray;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Get current length of the array using the handle.
|
|
|
|
const length = await page.evaluate(
|
|
|
|
(arg) => arg.myArray.length,
|
|
|
|
{ myArray: myArrayHandle }
|
|
|
|
);
|
|
|
|
|
|
|
|
// Add one more element to the array using the handle
|
|
|
|
await page.evaluate((arg) => arg.myArray.push(arg.newElement), {
|
|
|
|
myArray: myArrayHandle,
|
|
|
|
newElement: 2
|
|
|
|
});
|
|
|
|
|
|
|
|
// Get current length of the array using window.myArray reference.
|
|
|
|
const newLength = await page.evaluate(() => window.myArray.length);
|
|
|
|
|
|
|
|
// Release the object when it's no longer needed.
|
|
|
|
await myArrayHandle.dispose();
|
|
|
|
```
|
|
|
|
|
2020-04-20 09:46:36 -07:00
|
|
|
#### API reference
|
2020-12-30 18:04:51 -08:00
|
|
|
- [JSHandle]
|
|
|
|
- [ElementHandle]
|
|
|
|
- [page.evaluateHandle(pageFunction[, arg])](./api.md#pageevaluatehandlepagefunction-arg)
|
|
|
|
- [page.$(selector)](./api.md#pageselector)
|
|
|
|
- [page.$$(selector)](./api.md#pageselector-1)
|
|
|
|
- [jsHandle.evaluate(pageFunction[, arg])](./api.md#jshandleevaluatepagefunction-arg)
|
|
|
|
[Playwright]: api.md#class-playwright "Playwright"
|
|
|
|
[Browser]: api.md#class-browser "Browser"
|
|
|
|
[BrowserContext]: api.md#class-browsercontext "BrowserContext"
|
|
|
|
[Page]: api.md#class-page "Page"
|
|
|
|
[Frame]: api.md#class-frame "Frame"
|
|
|
|
[ElementHandle]: api.md#class-elementhandle "ElementHandle"
|
|
|
|
[JSHandle]: api.md#class-jshandle "JSHandle"
|
|
|
|
[ConsoleMessage]: api.md#class-consolemessage "ConsoleMessage"
|
|
|
|
[Dialog]: api.md#class-dialog "Dialog"
|
|
|
|
[Download]: api.md#class-download "Download"
|
|
|
|
[Video]: api.md#class-video "Video"
|
|
|
|
[FileChooser]: api.md#class-filechooser "FileChooser"
|
|
|
|
[Keyboard]: api.md#class-keyboard "Keyboard"
|
|
|
|
[Mouse]: api.md#class-mouse "Mouse"
|
|
|
|
[Touchscreen]: api.md#class-touchscreen "Touchscreen"
|
|
|
|
[Request]: api.md#class-request "Request"
|
|
|
|
[Response]: api.md#class-response "Response"
|
|
|
|
[Selectors]: api.md#class-selectors "Selectors"
|
|
|
|
[Route]: api.md#class-route "Route"
|
|
|
|
[WebSocket]: api.md#class-websocket "WebSocket"
|
|
|
|
[TimeoutError]: api.md#class-timeouterror "TimeoutError"
|
|
|
|
[Accessibility]: api.md#class-accessibility "Accessibility"
|
|
|
|
[Worker]: api.md#class-worker "Worker"
|
|
|
|
[BrowserServer]: api.md#class-browserserver "BrowserServer"
|
|
|
|
[BrowserType]: api.md#class-browsertype "BrowserType"
|
|
|
|
[Logger]: api.md#class-logger "Logger"
|
|
|
|
[ChromiumBrowser]: api.md#class-chromiumbrowser "ChromiumBrowser"
|
|
|
|
[ChromiumBrowserContext]: api.md#class-chromiumbrowsercontext "ChromiumBrowserContext"
|
|
|
|
[ChromiumCoverage]: api.md#class-chromiumcoverage "ChromiumCoverage"
|
|
|
|
[CDPSession]: api.md#class-cdpsession "CDPSession"
|
|
|
|
[FirefoxBrowser]: api.md#class-firefoxbrowser "FirefoxBrowser"
|
|
|
|
[WebKitBrowser]: api.md#class-webkitbrowser "WebKitBrowser"
|
|
|
|
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
|
|
|
|
[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
|
|
|
|
[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
|
|
|
|
[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"
|
|
|
|
[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
|
|
|
|
[EvaluationArgument]: #evaluationargument "Evaluation Argument"
|
|
|
|
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
|
|
|
|
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
|
|
|
|
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
|
|
|
|
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
|
|
|
|
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
|
|
|
|
[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
|
|
|
|
[URL]: https://nodejs.org/api/url.html "URL"
|
|
|
|
[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"
|
|
|
|
[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
|
|
|
|
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
|
|
|
|
[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
|
|
|
|
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"
|
|
|
|
[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
|
|
|
|
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
|
|
|
|
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"
|
|
|
|
[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"
|
|
|
|
[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
|
|
|
|
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
|
|
|
|
[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"
|