diff --git a/dotnet/docs/other-locators.mdx b/dotnet/docs/other-locators.mdx index 45cd3d18a7..6900288ef1 100644 --- a/dotnet/docs/other-locators.mdx +++ b/dotnet/docs/other-locators.mdx @@ -222,85 +222,6 @@ Alternatively, if you cannot find a suitable locator for the parent element, use var parent = page.GetByText("Hello").Locator("xpath=.."); ``` -## React locator - -:::note - -React locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -React locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In React locator, component names are transcribed with **CamelCase**. - -```csharp -await page.Locator("_react=BookItem").ClickAsync(); -``` - -More examples: -- match by **component**: `_react=BookItem` -- match by component and **exact property value**, case-sensitive: `_react=BookItem[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_react=[author = "steven king" i]` -- match by component and **truthy property value**: `_react=MyButton[enabled]` -- match by component and **boolean value**: `_react=MyButton[enabled = false]` -- match by property **value substring**: `_react=[author *= "King"]` -- match by component and **multiple properties**: `_react=BookItem[author *= "king" i][year = 1990]` -- match by **nested** property value: `_react=[some.nested.value = 12]` -- match by component and property value **prefix**: `_react=BookItem[author ^= "Steven"]` -- match by component and property value **suffix**: `_react=BookItem[author $= "Steven"]` -- match by component and **key**: `_react=BookItem[key = '2']` -- match by property value **regex**: `_react=[author = /Steven(\\s+King)?/i]` - -To find React element names in a tree use [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi). - -:::note - -React locator supports React 15 and above. -::: - -:::note -React locator, as well as [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - -## Vue locator - -:::note - -Vue locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -Vue locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In Vue locator, component names are transcribed with **kebab-case**. - -```csharp -await page.Locator("_vue=book-item").ClickAsync(); -``` - -More examples: -- match by **component**: `_vue=book-item` -- match by component and **exact property value**, case-sensitive: `_vue=book-item[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_vue=[author = "steven king" i]` -- match by component and **truthy property value**: `_vue=my-button[enabled]` -- match by component and **boolean value**: `_vue=my-button[enabled = false]` -- match by property **value substring**: `_vue=[author *= "King"]` -- match by component and **multiple properties**: `_vue=book-item[author *= "king" i][year = 1990]` -- match by **nested** property value: `_vue=[some.nested.value = 12]` -- match by component and property value **prefix**: `_vue=book-item[author ^= "Steven"]` -- match by component and property value **suffix**: `_vue=book-item[author $= "Steven"]` -- match by property value **regex**: `_vue=[author = /Steven(\\s+King)?/i]` - -To find Vue element names in a tree use [Vue DevTools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en). - -:::note - -Vue locator supports Vue2 and above. -::: - -:::note -Vue locator, as well as [Vue DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - ## XPath locator :::warning diff --git a/dotnet/docs/release-notes.mdx b/dotnet/docs/release-notes.mdx index 6c4a6eed8d..93ef870774 100644 --- a/dotnet/docs/release-notes.mdx +++ b/dotnet/docs/release-notes.mdx @@ -1514,7 +1514,7 @@ await locator.ClickAsync(); Learn more in the [documentation](./api/class-locator). -#### 🧩 Experimental [**React**](./other-locators.mdx#react-locator) and [**Vue**](./other-locators.mdx#vue-locator) selector engines +#### 🧩 Experimental [**React**](./other-locators.mdx) and [**Vue**](./other-locators.mdx) selector engines React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to [attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all attribute selector operators. @@ -1523,7 +1523,7 @@ await page.Locator("_react=SubmitButton[enabled=true]").ClickAsync(); await page.Locator("_vue=submit-button[enabled=true]").ClickAsync(); ``` -Learn more in the [react selectors documentation](./other-locators.mdx#react-locator) and the [vue selectors documentation](./other-locators.mdx#vue-locator). +Learn more in the [react selectors documentation](./other-locators.mdx) and the [vue selectors documentation](./other-locators.mdx). #### ✨ New [**`nth`**](./other-locators.mdx#n-th-element-locator) and [**`visible`**](./other-locators.mdx#css-matching-only-visible-elements) selector engines - [`nth`](./other-locators.mdx#n-th-element-locator) selector engine is equivalent to the `:nth-match` pseudo class, but could be combined with other selector engines. diff --git a/java/docs/other-locators.mdx b/java/docs/other-locators.mdx index f00a25a035..9fd3729694 100644 --- a/java/docs/other-locators.mdx +++ b/java/docs/other-locators.mdx @@ -222,85 +222,6 @@ Alternatively, if you cannot find a suitable locator for the parent element, use Locator parent = page.getByText("Hello").locator("xpath=.."); ``` -## React locator - -:::note - -React locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -React locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In React locator, component names are transcribed with **CamelCase**. - -```java -page.locator("_react=BookItem").click(); -``` - -More examples: -- match by **component**: `_react=BookItem` -- match by component and **exact property value**, case-sensitive: `_react=BookItem[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_react=[author = "steven king" i]` -- match by component and **truthy property value**: `_react=MyButton[enabled]` -- match by component and **boolean value**: `_react=MyButton[enabled = false]` -- match by property **value substring**: `_react=[author *= "King"]` -- match by component and **multiple properties**: `_react=BookItem[author *= "king" i][year = 1990]` -- match by **nested** property value: `_react=[some.nested.value = 12]` -- match by component and property value **prefix**: `_react=BookItem[author ^= "Steven"]` -- match by component and property value **suffix**: `_react=BookItem[author $= "Steven"]` -- match by component and **key**: `_react=BookItem[key = '2']` -- match by property value **regex**: `_react=[author = /Steven(\\s+King)?/i]` - -To find React element names in a tree use [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi). - -:::note - -React locator supports React 15 and above. -::: - -:::note -React locator, as well as [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - -## Vue locator - -:::note - -Vue locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -Vue locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In Vue locator, component names are transcribed with **kebab-case**. - -```java -page.locator("_vue=book-item").click(); -``` - -More examples: -- match by **component**: `_vue=book-item` -- match by component and **exact property value**, case-sensitive: `_vue=book-item[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_vue=[author = "steven king" i]` -- match by component and **truthy property value**: `_vue=my-button[enabled]` -- match by component and **boolean value**: `_vue=my-button[enabled = false]` -- match by property **value substring**: `_vue=[author *= "King"]` -- match by component and **multiple properties**: `_vue=book-item[author *= "king" i][year = 1990]` -- match by **nested** property value: `_vue=[some.nested.value = 12]` -- match by component and property value **prefix**: `_vue=book-item[author ^= "Steven"]` -- match by component and property value **suffix**: `_vue=book-item[author $= "Steven"]` -- match by property value **regex**: `_vue=[author = /Steven(\\s+King)?/i]` - -To find Vue element names in a tree use [Vue DevTools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en). - -:::note - -Vue locator supports Vue2 and above. -::: - -:::note -Vue locator, as well as [Vue DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - ## XPath locator :::warning diff --git a/java/docs/release-notes.mdx b/java/docs/release-notes.mdx index 5b728b4c89..efff5541ae 100644 --- a/java/docs/release-notes.mdx +++ b/java/docs/release-notes.mdx @@ -1524,7 +1524,7 @@ locator.click(); Learn more in the [documentation](./api/class-locator). -#### 🧩 Experimental [**React**](./other-locators.mdx#react-locator) and [**Vue**](./other-locators.mdx#vue-locator) selector engines +#### 🧩 Experimental [**React**](./other-locators.mdx) and [**Vue**](./other-locators.mdx) selector engines React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to [attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all attribute selector operators. @@ -1533,7 +1533,7 @@ page.locator("_react=SubmitButton[enabled=true]").click(); page.locator("_vue=submit-button[enabled=true]").click(); ``` -Learn more in the [react selectors documentation](./other-locators.mdx#react-locator) and the [vue selectors documentation](./other-locators.mdx#vue-locator). +Learn more in the [react selectors documentation](./other-locators.mdx) and the [vue selectors documentation](./other-locators.mdx). #### ✨ New [**`nth`**](./other-locators.mdx#n-th-element-locator) and [**`visible`**](./other-locators.mdx#css-matching-only-visible-elements) selector engines - [`nth`](./other-locators.mdx#n-th-element-locator) selector engine is equivalent to the `:nth-match` pseudo class, but could be combined with other selector engines. diff --git a/nodejs/docs/accessibility-testing.mdx b/nodejs/docs/accessibility-testing.mdx index 9b8f0b6fb0..91bb75a3a1 100644 --- a/nodejs/docs/accessibility-testing.mdx +++ b/nodejs/docs/accessibility-testing.mdx @@ -366,6 +366,7 @@ test('example using custom fixture', async ({ page, makeAxeBuilder }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/actionability.mdx b/nodejs/docs/actionability.mdx index e72c40edaa..9227ce688b 100644 --- a/nodejs/docs/actionability.mdx +++ b/nodejs/docs/actionability.mdx @@ -156,6 +156,7 @@ For example, consider a scenario where Playwright will click `Sign Up` button re [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api-testing.mdx b/nodejs/docs/api-testing.mdx index 5072e81220..418d6fa2e4 100644 --- a/nodejs/docs/api-testing.mdx +++ b/nodejs/docs/api-testing.mdx @@ -407,6 +407,7 @@ test('global context request has isolated cookie storage', async ({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-android.mdx b/nodejs/docs/api/class-android.mdx index 5df34f8dd1..99e61844cf 100644 --- a/nodejs/docs/api/class-android.mdx +++ b/nodejs/docs/api/class-android.mdx @@ -277,6 +277,7 @@ android.setDefaultTimeout(timeout); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-androiddevice.mdx b/nodejs/docs/api/class-androiddevice.mdx index a6ba2d859b..aefffad042 100644 --- a/nodejs/docs/api/class-androiddevice.mdx +++ b/nodejs/docs/api/class-androiddevice.mdx @@ -973,6 +973,7 @@ androidDevice.on('webview', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-androidinput.mdx b/nodejs/docs/api/class-androidinput.mdx index 5b8d3393a6..0b10491cec 100644 --- a/nodejs/docs/api/class-androidinput.mdx +++ b/nodejs/docs/api/class-androidinput.mdx @@ -191,6 +191,7 @@ await androidInput.type(text); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-androidsocket.mdx b/nodejs/docs/api/class-androidsocket.mdx index 0e32f9feb6..3182aca0e5 100644 --- a/nodejs/docs/api/class-androidsocket.mdx +++ b/nodejs/docs/api/class-androidsocket.mdx @@ -118,6 +118,7 @@ androidSocket.on('data', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-androidwebview.mdx b/nodejs/docs/api/class-androidwebview.mdx index ac1cc74037..d677c49b59 100644 --- a/nodejs/docs/api/class-androidwebview.mdx +++ b/nodejs/docs/api/class-androidwebview.mdx @@ -113,6 +113,7 @@ androidWebView.on('close', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-apirequest.mdx b/nodejs/docs/api/class-apirequest.mdx index 96b1c5220c..52991fb2e2 100644 --- a/nodejs/docs/api/class-apirequest.mdx +++ b/nodejs/docs/api/class-apirequest.mdx @@ -201,6 +201,7 @@ await apiRequest.newContext(options); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-apirequestcontext.mdx b/nodejs/docs/api/class-apirequestcontext.mdx index 2bfdad0740..c5fb425c6f 100644 --- a/nodejs/docs/api/class-apirequestcontext.mdx +++ b/nodejs/docs/api/class-apirequestcontext.mdx @@ -658,6 +658,7 @@ await apiRequestContext.storageState(options); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-apiresponse.mdx b/nodejs/docs/api/class-apiresponse.mdx index 0ac972bb66..45392f4667 100644 --- a/nodejs/docs/api/class-apiresponse.mdx +++ b/nodejs/docs/api/class-apiresponse.mdx @@ -224,6 +224,7 @@ apiResponse.url(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-apiresponseassertions.mdx b/nodejs/docs/api/class-apiresponseassertions.mdx index 1050a54e6b..d566f1cf19 100644 --- a/nodejs/docs/api/class-apiresponseassertions.mdx +++ b/nodejs/docs/api/class-apiresponseassertions.mdx @@ -96,6 +96,7 @@ expect(response).not [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-browser.mdx b/nodejs/docs/api/class-browser.mdx index e3208aad8d..a03a344383 100644 --- a/nodejs/docs/api/class-browser.mdx +++ b/nodejs/docs/api/class-browser.mdx @@ -895,6 +895,7 @@ browser.on('disconnected', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-browsercontext.mdx b/nodejs/docs/api/class-browsercontext.mdx index f168b63a53..59a69ad450 100644 --- a/nodejs/docs/api/class-browsercontext.mdx +++ b/nodejs/docs/api/class-browsercontext.mdx @@ -1361,6 +1361,7 @@ await browserContext.setHTTPCredentials(httpCredentials); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-browserserver.mdx b/nodejs/docs/api/class-browserserver.mdx index f636d8ba61..fb1c25d535 100644 --- a/nodejs/docs/api/class-browserserver.mdx +++ b/nodejs/docs/api/class-browserserver.mdx @@ -132,6 +132,7 @@ browserServer.on('close', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-browsertype.mdx b/nodejs/docs/api/class-browsertype.mdx index 5258a0f843..9eac5469b7 100644 --- a/nodejs/docs/api/class-browsertype.mdx +++ b/nodejs/docs/api/class-browsertype.mdx @@ -755,6 +755,7 @@ browserType.name(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-cdpsession.mdx b/nodejs/docs/api/class-cdpsession.mdx index 16a2f04d11..ac77fc9887 100644 --- a/nodejs/docs/api/class-cdpsession.mdx +++ b/nodejs/docs/api/class-cdpsession.mdx @@ -104,6 +104,7 @@ await cdpSession.send(method, params); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-clock.mdx b/nodejs/docs/api/class-clock.mdx index fc9247a602..27c66d833b 100644 --- a/nodejs/docs/api/class-clock.mdx +++ b/nodejs/docs/api/class-clock.mdx @@ -232,6 +232,7 @@ await page.clock.setSystemTime('2020-02-02'); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-consolemessage.mdx b/nodejs/docs/api/class-consolemessage.mdx index ce10419b8c..8a2f614185 100644 --- a/nodejs/docs/api/class-consolemessage.mdx +++ b/nodejs/docs/api/class-consolemessage.mdx @@ -175,6 +175,7 @@ consoleMessage.worker(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-coverage.mdx b/nodejs/docs/api/class-coverage.mdx index 00112c43a6..bc6fdd8b77 100644 --- a/nodejs/docs/api/class-coverage.mdx +++ b/nodejs/docs/api/class-coverage.mdx @@ -216,6 +216,7 @@ await coverage.stopJSCoverage(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-dialog.mdx b/nodejs/docs/api/class-dialog.mdx index 8f5d4a0881..c95d475aa2 100644 --- a/nodejs/docs/api/class-dialog.mdx +++ b/nodejs/docs/api/class-dialog.mdx @@ -175,6 +175,7 @@ dialog.type(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-download.mdx b/nodejs/docs/api/class-download.mdx index 520cc76461..09f0dab64b 100644 --- a/nodejs/docs/api/class-download.mdx +++ b/nodejs/docs/api/class-download.mdx @@ -225,6 +225,7 @@ download.url(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-electron.mdx b/nodejs/docs/api/class-electron.mdx index 8d4a4fc937..461ac06892 100644 --- a/nodejs/docs/api/class-electron.mdx +++ b/nodejs/docs/api/class-electron.mdx @@ -213,6 +213,7 @@ await electron.launch(options); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-electronapplication.mdx b/nodejs/docs/api/class-electronapplication.mdx index 005b4b9f64..f7cc04660e 100644 --- a/nodejs/docs/api/class-electronapplication.mdx +++ b/nodejs/docs/api/class-electronapplication.mdx @@ -344,6 +344,7 @@ electronApplication.on('window', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-elementhandle.mdx b/nodejs/docs/api/class-elementhandle.mdx index 9c2583e93b..2b52cf7a52 100644 --- a/nodejs/docs/api/class-elementhandle.mdx +++ b/nodejs/docs/api/class-elementhandle.mdx @@ -1625,6 +1625,7 @@ This method does not work across navigations, use [page.waitForSelector()](/api/ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-filechooser.mdx b/nodejs/docs/api/class-filechooser.mdx index c343795440..dad48b1c4b 100644 --- a/nodejs/docs/api/class-filechooser.mdx +++ b/nodejs/docs/api/class-filechooser.mdx @@ -147,6 +147,7 @@ await fileChooser.setFiles(files, options); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-fixtures.mdx b/nodejs/docs/api/class-fixtures.mdx index 7bf93dae00..c8bdf3266d 100644 --- a/nodejs/docs/api/class-fixtures.mdx +++ b/nodejs/docs/api/class-fixtures.mdx @@ -28,6 +28,21 @@ Playwright Test comes with builtin fixtures listed below, and you can add your o ## Properties +### agent {#fixtures-agent} + +Added in: v1.58fixtures.agent + +**Usage** + +```js +fixtures.agent +``` + +**Type** +- [PageAgent] + +--- + ### browser {#fixtures-browser} Added in: v1.10fixtures.browser @@ -180,6 +195,7 @@ test('basic test', async ({ request }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-frame.mdx b/nodejs/docs/api/class-frame.mdx index 6e8c9f484b..adc5ca5c43 100644 --- a/nodejs/docs/api/class-frame.mdx +++ b/nodejs/docs/api/class-frame.mdx @@ -2687,6 +2687,7 @@ await frame.waitForTimeout(timeout); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-framelocator.mdx b/nodejs/docs/api/class-framelocator.mdx index 9605686033..821da2350d 100644 --- a/nodejs/docs/api/class-framelocator.mdx +++ b/nodejs/docs/api/class-framelocator.mdx @@ -569,6 +569,7 @@ frameLocator.nth(index); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-fullconfig.mdx b/nodejs/docs/api/class-fullconfig.mdx index fa00830f5f..6158aa3a16 100644 --- a/nodejs/docs/api/class-fullconfig.mdx +++ b/nodejs/docs/api/class-fullconfig.mdx @@ -298,6 +298,26 @@ fullConfig.rootDir --- +### runAgents {#full-config-run-agents} + +Added in: v1.58fullConfig.runAgents + +Whether to run LLM agent for [PageAgent]: +* "all" disregards existing cache and performs all actions via LLM +* "missing" only performs actions that don't have generated cache actions +* "none" does not talk to LLM at all, relies on the cached actions (default) + +**Usage** + +```js +fullConfig.runAgents +``` + +**Type** +- "all" | "missing" | "none" + +--- + ### shard {#full-config-shard} Added in: v1.10fullConfig.shard @@ -455,6 +475,7 @@ fullConfig.workers [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-fullproject.mdx b/nodejs/docs/api/class-fullproject.mdx index 29752586f3..36e220a4c8 100644 --- a/nodejs/docs/api/class-fullproject.mdx +++ b/nodejs/docs/api/class-fullproject.mdx @@ -65,6 +65,23 @@ fullProject.grepInvert --- +### ignoreSnapshots {#full-project-ignore-snapshots} + +Added in: v1.59fullProject.ignoreSnapshots + +See [testProject.ignoreSnapshots](/api/class-testproject.mdx#test-project-ignore-snapshots). + +**Usage** + +```js +fullProject.ignoreSnapshots +``` + +**Type** +- [boolean] + +--- + ### metadata {#full-project-metadata} Added in: v1.10fullProject.metadata @@ -301,6 +318,7 @@ fullProject.use [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-genericassertions.mdx b/nodejs/docs/api/class-genericassertions.mdx index 3a5ddfe0ef..8e2bde4fb6 100644 --- a/nodejs/docs/api/class-genericassertions.mdx +++ b/nodejs/docs/api/class-genericassertions.mdx @@ -818,6 +818,7 @@ expect(value).not [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-jshandle.mdx b/nodejs/docs/api/class-jshandle.mdx index 91512d911a..e817bfb25f 100644 --- a/nodejs/docs/api/class-jshandle.mdx +++ b/nodejs/docs/api/class-jshandle.mdx @@ -218,6 +218,7 @@ await jsHandle.jsonValue(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-keyboard.mdx b/nodejs/docs/api/class-keyboard.mdx index c6e877d211..a919296583 100644 --- a/nodejs/docs/api/class-keyboard.mdx +++ b/nodejs/docs/api/class-keyboard.mdx @@ -259,6 +259,7 @@ await keyboard.up(key); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-location.mdx b/nodejs/docs/api/class-location.mdx index 0bb4c721c3..056ec87d32 100644 --- a/nodejs/docs/api/class-location.mdx +++ b/nodejs/docs/api/class-location.mdx @@ -97,6 +97,7 @@ location.line [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-locator.mdx b/nodejs/docs/api/class-locator.mdx index e8c54761c3..384d0b0c51 100644 --- a/nodejs/docs/api/class-locator.mdx +++ b/nodejs/docs/api/class-locator.mdx @@ -2569,6 +2569,7 @@ To press a special key, like `Control` or `ArrowDown`, use [locator.press()](/ap [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-locatorassertions.mdx b/nodejs/docs/api/class-locatorassertions.mdx index 9e7a3e0cdc..e3f22018b3 100644 --- a/nodejs/docs/api/class-locatorassertions.mdx +++ b/nodejs/docs/api/class-locatorassertions.mdx @@ -1123,6 +1123,7 @@ expect(locator).not [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-logger.mdx b/nodejs/docs/api/class-logger.mdx index e291800f4b..8f6470e1ab 100644 --- a/nodejs/docs/api/class-logger.mdx +++ b/nodejs/docs/api/class-logger.mdx @@ -118,6 +118,7 @@ logger.log(name, severity, message, args, hints); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-mouse.mdx b/nodejs/docs/api/class-mouse.mdx index 21c60e8102..43eebd33ce 100644 --- a/nodejs/docs/api/class-mouse.mdx +++ b/nodejs/docs/api/class-mouse.mdx @@ -247,6 +247,7 @@ await mouse.wheel(deltaX, deltaY); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-page.mdx b/nodejs/docs/api/class-page.mdx index 2d070378d0..10b8a3ac60 100644 --- a/nodejs/docs/api/class-page.mdx +++ b/nodejs/docs/api/class-page.mdx @@ -257,6 +257,72 @@ await page.addStyleTag(options); --- +### agent {#page-agent} + +Added in: v1.58page.agent + +Initialize page agent with the llm provider and cache. + +**Usage** + +```js +await page.agent(); +await page.agent(options); +``` + +**Arguments** +- `options` [Object] *(optional)* + - `cache` [Object] *(optional)*# + - `cacheFile` [string] *(optional)* + + Cache file to use/generate code for performed actions into. Cache is not used if not specified (default). + - `cacheOutFile` [string] *(optional)* + + When specified, generated entries are written into the `cacheOutFile` instead of updating the `cacheFile`. + - `expect` [Object] *(optional)*# + - `timeout` [number] *(optional)* + + Default timeout for expect calls in milliseconds, defaults to 5000ms. + - `limits` [Object] *(optional)*# + - `maxTokens` [number] *(optional)* + + Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value. Defaults to unlimited. + - `maxActions` [number] *(optional)* + + Maximum number of agentic actions to generate, defaults to 10. + - `maxActionRetries` [number] *(optional)* + + Maximum number retries per action, defaults to 3. + + Limits to use for the agentic loop. + - `provider` [Object] *(optional)*# + - `api` "openai" | "openai-compatible" | "anthropic" | "google" + + API to use. + - `apiEndpoint` [string] *(optional)* + + Endpoint to use if different from default. + - `apiKey` [string] + + API key for the LLM provider. + - `apiTimeout` [number] *(optional)* + + Amount of time to wait for the provider to respond to each request. + - `model` [string] + + Model identifier within the provider. Required in non-cache mode. + - `secrets` [Object]<[string], [string]> *(optional)*# + + Secrets to hide from the LLM. + - `systemPrompt` [string] *(optional)*# + + System prompt for the agent's loop. + +**Returns** +- [Promise]<[PageAgent]># + +--- + ### bringToFront {#page-bring-to-front} Added before v1.9page.bringToFront @@ -4529,6 +4595,7 @@ await page.waitForTimeout(1000); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-pageagent.mdx b/nodejs/docs/api/class-pageagent.mdx new file mode 100644 index 0000000000..e53b521f2f --- /dev/null +++ b/nodejs/docs/api/class-pageagent.mdx @@ -0,0 +1,335 @@ +--- +id: class-pageagent +title: "PageAgent" +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import HTMLCard from '@site/src/components/HTMLCard'; + + + +--- + +## Methods + +### dispose {#page-agent-dispose} + +Added in: v1.58pageAgent.dispose + +Dispose this agent. + +**Usage** + +```js +await pageAgent.dispose(); +``` + +**Returns** +- [Promise]<[void]># + +--- + +### expect {#page-agent-expect} + +Added in: v1.58pageAgent.expect + +Expect certain condition to be met. + +**Usage** + +```js +await agent.expect('"0 items" to be reported'); +``` + +**Arguments** +- `expectation` [string]# + + Expectation to assert. +- `options` [Object] *(optional)* + - `cacheKey` [string] *(optional)*# + + All the agentic actions are converted to the Playwright calls and are cached. By default, they are cached globally with the `task` as a key. This option allows controlling the cache key explicitly. + - `maxActionRetries` [number] *(optional)*# + + Maximum number of retries when generating each action, defaults to context-wide value specified in `agent` property. + - `maxActions` [number] *(optional)*# + + Maximum number of agentic actions to generate, defaults to context-wide value specified in `agent` property. + - `maxTokens` [number] *(optional)*# + + Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value. Defaults to context-wide value specified in `agent` property. + - `timeout` [number] *(optional)*# + + Expect timeout in milliseconds. Defaults to `5000`. The default value can be changed via `expect.timeout` option in the config, or by specifying the `expect` property of the [expect](/api/class-page.mdx#page-agent-option-expect) option. Pass `0` to disable timeout. + +**Returns** +- [Promise]<[void]># + +--- + +### extract {#page-agent-extract} + +Added in: v1.58pageAgent.extract + +Extract information from the page using the agentic loop, return it in a given Zod format. + +**Usage** + +```js +await agent.extract('List of items in the cart', z.object({ + title: z.string().describe('Item title to extract'), + price: z.string().describe('Item price to extract'), +}).array()); +``` + +**Arguments** +- `query` [string]# + + Task to perform using agentic loop. +- `schema` [z.ZodSchema]# +- `options` [Object] *(optional)* + - `cacheKey` [string] *(optional)*# + + All the agentic actions are converted to the Playwright calls and are cached. By default, they are cached globally with the `task` as a key. This option allows controlling the cache key explicitly. + - `maxActionRetries` [number] *(optional)*# + + Maximum number of retries when generating each action, defaults to context-wide value specified in `agent` property. + - `maxActions` [number] *(optional)*# + + Maximum number of agentic actions to generate, defaults to context-wide value specified in `agent` property. + - `maxTokens` [number] *(optional)*# + + Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value. Defaults to context-wide value specified in `agent` property. + - `timeout` [number] *(optional)*# + + Extract timeout in milliseconds. Defaults to `5000`. The default value can be changed via `actionTimeout` option in the config, or by using the [browserContext.setDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout) or [page.setDefaultTimeout()](/api/class-page.mdx#page-set-default-timeout) methods. Pass `0` to disable timeout. + +**Returns** +- [Promise]<[Object]># + - `result` [Object] + + + - `usage` [Object] + - `turns` [number] + + + - `inputTokens` [number] + + + - `outputTokens` [number] + + + +--- + +### perform {#page-agent-perform} + +Added in: v1.58pageAgent.perform + +Perform action using agentic loop. + +**Usage** + +```js +await agent.perform('Click submit button'); +``` + +**Arguments** +- `task` [string]# + + Task to perform using agentic loop. +- `options` [Object] *(optional)* + - `cacheKey` [string] *(optional)*# + + All the agentic actions are converted to the Playwright calls and are cached. By default, they are cached globally with the `task` as a key. This option allows controlling the cache key explicitly. + - `maxActionRetries` [number] *(optional)*# + + Maximum number of retries when generating each action, defaults to context-wide value specified in `agent` property. + - `maxActions` [number] *(optional)*# + + Maximum number of agentic actions to generate, defaults to context-wide value specified in `agent` property. + - `maxTokens` [number] *(optional)*# + + Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value. Defaults to context-wide value specified in `agent` property. + - `timeout` [number] *(optional)*# + + Perform timeout in milliseconds. Defaults to `5000`. The default value can be changed via `actionTimeout` option in the config, or by using the [browserContext.setDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout) or [page.setDefaultTimeout()](/api/class-page.mdx#page-set-default-timeout) methods. Pass `0` to disable timeout. + +**Returns** +- [Promise]<[Object]># + - `usage` [Object] + - `turns` [number] + + + - `inputTokens` [number] + + + - `outputTokens` [number] + + + +--- + +### usage {#page-agent-usage} + +Added in: v1.58pageAgent.usage + +Returns the current token usage for this agent. + +**Usage** + +```js +const usage = await agent.usage(); +console.log(`Tokens used: ${usage.inputTokens} in, ${usage.outputTokens} out`); +``` + +**Returns** +- [Promise]<[Object]># + - `turns` [number] + + + - `inputTokens` [number] + + + - `outputTokens` [number] + + +--- + +## Events + +### on('turn') {#page-agent-event-turn} + +Added in: v1.58pageAgent.on('turn') + +Emitted when the agent makes a turn. + +**Usage** + +```js +pageAgent.on('turn', data => {}); +``` + +**Event data** +- [Object] + - `role` [string] + + + - `message` [string] + + + - `usage` [Object] *(optional)* + - `inputTokens` [number] + + + - `outputTokens` [number] + + + + + +[Android]: /api/class-android.mdx "Android" +[AndroidDevice]: /api/class-androiddevice.mdx "AndroidDevice" +[AndroidInput]: /api/class-androidinput.mdx "AndroidInput" +[AndroidSocket]: /api/class-androidsocket.mdx "AndroidSocket" +[AndroidWebView]: /api/class-androidwebview.mdx "AndroidWebView" +[APIRequest]: /api/class-apirequest.mdx "APIRequest" +[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" +[APIResponse]: /api/class-apiresponse.mdx "APIResponse" +[APIResponseAssertions]: /api/class-apiresponseassertions.mdx "APIResponseAssertions" +[Browser]: /api/class-browser.mdx "Browser" +[BrowserContext]: /api/class-browsercontext.mdx "BrowserContext" +[BrowserServer]: /api/class-browserserver.mdx "BrowserServer" +[BrowserType]: /api/class-browsertype.mdx "BrowserType" +[CDPSession]: /api/class-cdpsession.mdx "CDPSession" +[Clock]: /api/class-clock.mdx "Clock" +[ConsoleMessage]: /api/class-consolemessage.mdx "ConsoleMessage" +[Coverage]: /api/class-coverage.mdx "Coverage" +[Dialog]: /api/class-dialog.mdx "Dialog" +[Download]: /api/class-download.mdx "Download" +[Electron]: /api/class-electron.mdx "Electron" +[ElectronApplication]: /api/class-electronapplication.mdx "ElectronApplication" +[ElementHandle]: /api/class-elementhandle.mdx "ElementHandle" +[FileChooser]: /api/class-filechooser.mdx "FileChooser" +[Frame]: /api/class-frame.mdx "Frame" +[FrameLocator]: /api/class-framelocator.mdx "FrameLocator" +[GenericAssertions]: /api/class-genericassertions.mdx "GenericAssertions" +[JSHandle]: /api/class-jshandle.mdx "JSHandle" +[Keyboard]: /api/class-keyboard.mdx "Keyboard" +[Locator]: /api/class-locator.mdx "Locator" +[LocatorAssertions]: /api/class-locatorassertions.mdx "LocatorAssertions" +[Logger]: /api/class-logger.mdx "Logger" +[Mouse]: /api/class-mouse.mdx "Mouse" +[Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" +[PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" +[Playwright]: /api/class-playwright.mdx "Playwright" +[PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" +[Request]: /api/class-request.mdx "Request" +[Response]: /api/class-response.mdx "Response" +[Route]: /api/class-route.mdx "Route" +[Selectors]: /api/class-selectors.mdx "Selectors" +[SnapshotAssertions]: /api/class-snapshotassertions.mdx "SnapshotAssertions" +[TimeoutError]: /api/class-timeouterror.mdx "TimeoutError" +[Touchscreen]: /api/class-touchscreen.mdx "Touchscreen" +[Tracing]: /api/class-tracing.mdx "Tracing" +[Video]: /api/class-video.mdx "Video" +[WebError]: /api/class-weberror.mdx "WebError" +[WebSocket]: /api/class-websocket.mdx "WebSocket" +[WebSocketRoute]: /api/class-websocketroute.mdx "WebSocketRoute" +[Worker]: /api/class-worker.mdx "Worker" +[Fixtures]: /api/class-fixtures.mdx "Fixtures" +[FullConfig]: /api/class-fullconfig.mdx "FullConfig" +[FullProject]: /api/class-fullproject.mdx "FullProject" +[Location]: /api/class-location.mdx "Location" +[Test]: /api/class-test.mdx "Test" +[TestConfig]: /api/class-testconfig.mdx "TestConfig" +[TestInfo]: /api/class-testinfo.mdx "TestInfo" +[TestInfoError]: /api/class-testinfoerror.mdx "TestInfoError" +[TestOptions]: /api/class-testoptions.mdx "TestOptions" +[TestProject]: /api/class-testproject.mdx "TestProject" +[TestStepInfo]: /api/class-teststepinfo.mdx "TestStepInfo" +[WorkerInfo]: /api/class-workerinfo.mdx "WorkerInfo" +[Reporter]: /api/class-reporter.mdx "Reporter" +[Suite]: /api/class-suite.mdx "Suite" +[TestCase]: /api/class-testcase.mdx "TestCase" +[TestError]: /api/class-testerror.mdx "TestError" +[TestResult]: /api/class-testresult.mdx "TestResult" +[TestStep]: /api/class-teststep.mdx "TestStep" +[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element" +[EvaluationArgument]: /evaluating.mdx#evaluation-argument "EvaluationArgument" +[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise" +[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator" +[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin" +[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector" +[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" +[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time" +[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath" + +[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array" +[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean" +[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer" +[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess" +[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date "Date" +[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error" +[EventEmitter]: https://nodejs.org/api/events.html#events_class_eventemitter "EventEmitter" +[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function" +[FormData]: https://developer.mozilla.org/en-US/docs/Web/API/FormData "FormData" +[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map" +[Metadata]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object<string, any>" +[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" +[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" +[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable" +[ReadStream]: https://nodejs.org/api/fs.html#class-fsreadstream "ReadStream" +[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp" +[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string" +[void]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined "void" +[URL]: https://nodejs.org/api/url.html "URL" +[URLSearchParams]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams "URLSearchParams" + +[all available image tags]: https://mcr.microsoft.com/en-us/product/playwright/about "all available image tags" +[Microsoft Artifact Registry]: https://mcr.microsoft.com/en-us/product/playwright/about "Microsoft Artifact Registry" +[Dockerfile.noble]: https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.noble "Dockerfile.noble" diff --git a/nodejs/docs/api/class-pageassertions.mdx b/nodejs/docs/api/class-pageassertions.mdx index 5e1bde1ddd..74e053becc 100644 --- a/nodejs/docs/api/class-pageassertions.mdx +++ b/nodejs/docs/api/class-pageassertions.mdx @@ -306,6 +306,7 @@ expect(page).not [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-playwright.mdx b/nodejs/docs/api/class-playwright.mdx index 8f0437ad0d..b6d40a41f0 100644 --- a/nodejs/docs/api/class-playwright.mdx +++ b/nodejs/docs/api/class-playwright.mdx @@ -210,6 +210,7 @@ playwright.webkit [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-playwrightassertions.mdx b/nodejs/docs/api/class-playwrightassertions.mdx index 9be5970926..132a3987a7 100644 --- a/nodejs/docs/api/class-playwrightassertions.mdx +++ b/nodejs/docs/api/class-playwrightassertions.mdx @@ -138,6 +138,7 @@ Creates a [PageAssertions] object for the given [Page]. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-reporter.mdx b/nodejs/docs/api/class-reporter.mdx index d30824d02b..6e14897478 100644 --- a/nodejs/docs/api/class-reporter.mdx +++ b/nodejs/docs/api/class-reporter.mdx @@ -409,6 +409,7 @@ reporter.printsToStdio(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-request.mdx b/nodejs/docs/api/class-request.mdx index 18b9c4b6eb..a44b77db28 100644 --- a/nodejs/docs/api/class-request.mdx +++ b/nodejs/docs/api/class-request.mdx @@ -482,6 +482,7 @@ request.url(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-response.mdx b/nodejs/docs/api/class-response.mdx index 346bca72b5..fd0541d4c9 100644 --- a/nodejs/docs/api/class-response.mdx +++ b/nodejs/docs/api/class-response.mdx @@ -390,6 +390,7 @@ response.url(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-route.mdx b/nodejs/docs/api/class-route.mdx index 42ffe92fed..d8504bb372 100644 --- a/nodejs/docs/api/class-route.mdx +++ b/nodejs/docs/api/class-route.mdx @@ -345,6 +345,7 @@ route.request(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-selectors.mdx b/nodejs/docs/api/class-selectors.mdx index 1f0463565e..87f2533c85 100644 --- a/nodejs/docs/api/class-selectors.mdx +++ b/nodejs/docs/api/class-selectors.mdx @@ -133,6 +133,7 @@ selectors.setTestIdAttribute(attributeName); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-snapshotassertions.mdx b/nodejs/docs/api/class-snapshotassertions.mdx index cc15a3e11e..a0923964ed 100644 --- a/nodejs/docs/api/class-snapshotassertions.mdx +++ b/nodejs/docs/api/class-snapshotassertions.mdx @@ -151,6 +151,7 @@ Note that matching snapshots only work with Playwright test runner. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-suite.mdx b/nodejs/docs/api/class-suite.mdx index 277e25cdf1..25c38d1fcc 100644 --- a/nodejs/docs/api/class-suite.mdx +++ b/nodejs/docs/api/class-suite.mdx @@ -237,6 +237,7 @@ suite.type [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-test.mdx b/nodejs/docs/api/class-test.mdx index b68080aa14..be374520a1 100644 --- a/nodejs/docs/api/class-test.mdx +++ b/nodejs/docs/api/class-test.mdx @@ -1910,6 +1910,7 @@ test.describe.serial.only(() => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testcase.mdx b/nodejs/docs/api/class-testcase.mdx index 194370aee3..bf283dd6c0 100644 --- a/nodejs/docs/api/class-testcase.mdx +++ b/nodejs/docs/api/class-testcase.mdx @@ -323,6 +323,7 @@ testCase.type [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testconfig.mdx b/nodejs/docs/api/class-testconfig.mdx index 97619298fd..28d39a0bad 100644 --- a/nodejs/docs/api/class-testconfig.mdx +++ b/nodejs/docs/api/class-testconfig.mdx @@ -671,6 +671,26 @@ export default defineConfig({ --- +### runAgents {#test-config-run-agents} + +Added in: v1.58testConfig.runAgents + +Whether to run LLM agent for [PageAgent]: +* "all" disregards existing cache and performs all actions via LLM +* "missing" only performs actions that don't have generated cache actions +* "none" does not talk to LLM at all, relies on the cached actions (default) + +**Usage** + +```js +testConfig.runAgents +``` + +**Type** +- "all" | "missing" | "none" + +--- + ### shard {#test-config-shard} Added in: v1.10testConfig.shard @@ -1256,6 +1276,7 @@ This path will serve as the base directory for each test file snapshot directory [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testerror.mdx b/nodejs/docs/api/class-testerror.mdx index 908b2b0352..dca6dd3793 100644 --- a/nodejs/docs/api/class-testerror.mdx +++ b/nodejs/docs/api/class-testerror.mdx @@ -148,6 +148,7 @@ testError.value [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testinfo.mdx b/nodejs/docs/api/class-testinfo.mdx index 9b396cadeb..7826b9f9b2 100644 --- a/nodejs/docs/api/class-testinfo.mdx +++ b/nodejs/docs/api/class-testinfo.mdx @@ -894,6 +894,7 @@ testInfo.workerIndex [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testinfoerror.mdx b/nodejs/docs/api/class-testinfoerror.mdx index 81f237a2b1..a1ea68ee1d 100644 --- a/nodejs/docs/api/class-testinfoerror.mdx +++ b/nodejs/docs/api/class-testinfoerror.mdx @@ -114,6 +114,7 @@ testInfoError.value [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testoptions.mdx b/nodejs/docs/api/class-testoptions.mdx index 6e108dd169..9a34db6242 100644 --- a/nodejs/docs/api/class-testoptions.mdx +++ b/nodejs/docs/api/class-testoptions.mdx @@ -92,6 +92,60 @@ Learn more about [various timeouts](../test-timeouts.mdx). --- +### agentOptions {#test-options-agent-options} + +Added in: v1.58testOptions.agentOptions + +**Usage** + +```js +testOptions.agentOptions +``` + +**Type** +- [Object] + - `provider` [Object] + - `api` "openai" | "openai-compatible" | "anthropic" | "google" + + API to use. + - `apiEndpoint` [string] *(optional)* + + Endpoint to use if different from default. + - `apiKey` [string] + + API key for the LLM provider. + - `apiTimeout` [number] *(optional)* + + Amount of time to wait for the provider to respond to each request. + - `model` [string] + + Model identifier within the provider. Required in non-cache mode. + + + - `cachePathTemplate` [string] *(optional)* + + Cache file template to use/generate code for performed actions into. + - `limits` [Object] + - `maxTokens` [number] *(optional)* + + Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value. Defaults to unlimited. + - `maxActions` [number] *(optional)* + + Maximum number of agentic actions to generate, defaults to 10. + - `maxActionRetries` [number] *(optional)* + + Maximum number retries per action, defaults to 3. + + + - `secrets` [Object]<[string], [string]> *(optional)* + + Secrets to hide from the LLM. + - `systemPrompt` [string] + + System prompt for the agent's loop. + +--- + ### baseURL {#test-options-base-url} Added in: v1.10testOptions.baseURL @@ -1115,6 +1169,7 @@ export default defineConfig({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testproject.mdx b/nodejs/docs/api/class-testproject.mdx index bd0d80b316..d8105f1fa6 100644 --- a/nodejs/docs/api/class-testproject.mdx +++ b/nodejs/docs/api/class-testproject.mdx @@ -798,6 +798,7 @@ export default defineConfig({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-testresult.mdx b/nodejs/docs/api/class-testresult.mdx index 732d22b35f..52d9172399 100644 --- a/nodejs/docs/api/class-testresult.mdx +++ b/nodejs/docs/api/class-testresult.mdx @@ -299,6 +299,7 @@ testResult.workerIndex [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-teststep.mdx b/nodejs/docs/api/class-teststep.mdx index b012a91ec4..b21cf96b03 100644 --- a/nodejs/docs/api/class-teststep.mdx +++ b/nodejs/docs/api/class-teststep.mdx @@ -262,6 +262,7 @@ testStep.title [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-teststepinfo.mdx b/nodejs/docs/api/class-teststepinfo.mdx index ea57cef823..c2850787f3 100644 --- a/nodejs/docs/api/class-teststepinfo.mdx +++ b/nodejs/docs/api/class-teststepinfo.mdx @@ -193,6 +193,7 @@ testStepInfo.titlePath [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-timeouterror.mdx b/nodejs/docs/api/class-timeouterror.mdx index dcdafa8fd7..859990d643 100644 --- a/nodejs/docs/api/class-timeouterror.mdx +++ b/nodejs/docs/api/class-timeouterror.mdx @@ -64,6 +64,7 @@ const playwright = require('playwright'); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-touchscreen.mdx b/nodejs/docs/api/class-touchscreen.mdx index affa0426ed..b934a497f4 100644 --- a/nodejs/docs/api/class-touchscreen.mdx +++ b/nodejs/docs/api/class-touchscreen.mdx @@ -78,6 +78,7 @@ await touchscreen.tap(x, y); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-tracing.mdx b/nodejs/docs/api/class-tracing.mdx index 89507a47dc..3b01b70c5e 100644 --- a/nodejs/docs/api/class-tracing.mdx +++ b/nodejs/docs/api/class-tracing.mdx @@ -258,6 +258,7 @@ await tracing.stopChunk(options); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-video.mdx b/nodejs/docs/api/class-video.mdx index 443c312dd1..23e2f05e01 100644 --- a/nodejs/docs/api/class-video.mdx +++ b/nodejs/docs/api/class-video.mdx @@ -106,6 +106,7 @@ await video.saveAs(path); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-weberror.mdx b/nodejs/docs/api/class-weberror.mdx index e171e785b5..3617849b30 100644 --- a/nodejs/docs/api/class-weberror.mdx +++ b/nodejs/docs/api/class-weberror.mdx @@ -90,6 +90,7 @@ webError.page(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-websocket.mdx b/nodejs/docs/api/class-websocket.mdx index 09d4af5050..3d3819042c 100644 --- a/nodejs/docs/api/class-websocket.mdx +++ b/nodejs/docs/api/class-websocket.mdx @@ -194,6 +194,7 @@ webSocket.on('socketerror', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-websocketroute.mdx b/nodejs/docs/api/class-websocketroute.mdx index b80ad8539a..11859eec83 100644 --- a/nodejs/docs/api/class-websocketroute.mdx +++ b/nodejs/docs/api/class-websocketroute.mdx @@ -245,6 +245,7 @@ webSocketRoute.url(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-worker.mdx b/nodejs/docs/api/class-worker.mdx index 702f80b884..fd60d5888b 100644 --- a/nodejs/docs/api/class-worker.mdx +++ b/nodejs/docs/api/class-worker.mdx @@ -206,6 +206,7 @@ worker.on('console', data => {}); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/api/class-workerinfo.mdx b/nodejs/docs/api/class-workerinfo.mdx index 92ed01ef65..3eb8e0722b 100644 --- a/nodejs/docs/api/class-workerinfo.mdx +++ b/nodejs/docs/api/class-workerinfo.mdx @@ -118,6 +118,7 @@ workerInfo.workerIndex [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/aria-snapshots.mdx b/nodejs/docs/aria-snapshots.mdx index a6dca0f779..6925c19c29 100644 --- a/nodejs/docs/aria-snapshots.mdx +++ b/nodejs/docs/aria-snapshots.mdx @@ -467,6 +467,7 @@ Commonly used ARIA attributes, like `checked`, `disabled`, `expanded`, `level`, [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/auth.mdx b/nodejs/docs/auth.mdx index ede1747a40..3f7a142988 100644 --- a/nodejs/docs/auth.mdx +++ b/nodejs/docs/auth.mdx @@ -560,6 +560,7 @@ test('not signed in test', async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/best-practices.mdx b/nodejs/docs/best-practices.mdx index 87407800c0..a4e158c45b 100644 --- a/nodejs/docs/best-practices.mdx +++ b/nodejs/docs/best-practices.mdx @@ -544,6 +544,7 @@ await page.getByRole('link', { name: 'next page' }).click(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/browser-contexts.mdx b/nodejs/docs/browser-contexts.mdx index e5a9783c25..ce36f4c4ee 100644 --- a/nodejs/docs/browser-contexts.mdx +++ b/nodejs/docs/browser-contexts.mdx @@ -148,6 +148,7 @@ const userPage = await userContext.newPage(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/browsers.mdx b/nodejs/docs/browsers.mdx index 3ea6555031..07aedaf32a 100644 --- a/nodejs/docs/browsers.mdx +++ b/nodejs/docs/browsers.mdx @@ -672,6 +672,7 @@ npx playwright uninstall --all [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/canary-releases.mdx b/nodejs/docs/canary-releases.mdx index 4a4405fd2f..ea4911e04a 100644 --- a/nodejs/docs/canary-releases.mdx +++ b/nodejs/docs/canary-releases.mdx @@ -74,6 +74,7 @@ The stable and the `next` documentation is published on [playwright.dev](https:/ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/chrome-extensions.mdx b/nodejs/docs/chrome-extensions.mdx index 8afc154d18..795fa39aa8 100644 --- a/nodejs/docs/chrome-extensions.mdx +++ b/nodejs/docs/chrome-extensions.mdx @@ -132,6 +132,7 @@ test('popup page', async ({ page, extensionId }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/ci-intro.mdx b/nodejs/docs/ci-intro.mdx index bfc1dde810..672c480def 100644 --- a/nodejs/docs/ci-intro.mdx +++ b/nodejs/docs/ci-intro.mdx @@ -197,6 +197,7 @@ Artifacts like trace files, HTML reports or even the console logs contain inform [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/ci.mdx b/nodejs/docs/ci.mdx index c63a4f2913..c57d018a8c 100644 --- a/nodejs/docs/ci.mdx +++ b/nodejs/docs/ci.mdx @@ -101,7 +101,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright:v1.57.0-noble + image: mcr.microsoft.com/playwright:v1.58.0-noble options: --user 1001 steps: - uses: actions/checkout@v5 @@ -335,7 +335,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright:v1.57.0-noble +container: mcr.microsoft.com/playwright:v1.58.0-noble steps: - task: UseNode@1 @@ -359,7 +359,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-noble-development: docker: - - image: mcr.microsoft.com/playwright:v1.57.0-noble + - image: mcr.microsoft.com/playwright:v1.58.0-noble ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -382,7 +382,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright:v1.57.0-noble' } } + agent { docker { image 'mcr.microsoft.com/playwright:v1.58.0-noble' } } stages { stage('e2e-tests') { steps { @@ -399,7 +399,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright:v1.57.0-noble +image: mcr.microsoft.com/playwright:v1.58.0-noble ``` ### GitLab CI @@ -412,7 +412,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.57.0-noble + image: mcr.microsoft.com/playwright:v1.58.0-noble script: ... ``` @@ -427,7 +427,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.57.0-noble + image: mcr.microsoft.com/playwright:v1.58.0-noble parallel: 7 script: - npm ci @@ -442,7 +442,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.57.0-noble + image: mcr.microsoft.com/playwright:v1.58.0-noble parallel: matrix: - PROJECT: ['chromium', 'webkit'] @@ -458,7 +458,7 @@ To run Playwright tests on Google Cloud Build, use our public Docker image ([see ```yml steps: -- name: mcr.microsoft.com/playwright:v1.57.0-noble +- name: mcr.microsoft.com/playwright:v1.58.0-noble script: ... env: @@ -476,7 +476,7 @@ type: docker steps: - name: test - image: mcr.microsoft.com/playwright:v1.57.0-noble + image: mcr.microsoft.com/playwright:v1.58.0-noble commands: - npx playwright test ``` @@ -539,6 +539,7 @@ xvfb-run npx playwright test [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/clock.mdx b/nodejs/docs/clock.mdx index 3317a1419a..2ae40cf979 100644 --- a/nodejs/docs/clock.mdx +++ b/nodejs/docs/clock.mdx @@ -210,6 +210,7 @@ await expect(page.getByTestId('current-time')).toHaveText('2/2/2024, 10:00:02 AM [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/codegen-intro.mdx b/nodejs/docs/codegen-intro.mdx index a81f988397..a97b28d0ba 100644 --- a/nodejs/docs/codegen-intro.mdx +++ b/nodejs/docs/codegen-intro.mdx @@ -96,6 +96,7 @@ You can generate tests using emulation for specific viewports, devices, color sc [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/codegen.mdx b/nodejs/docs/codegen.mdx index f98c388aae..32f5600b82 100644 --- a/nodejs/docs/codegen.mdx +++ b/nodejs/docs/codegen.mdx @@ -252,6 +252,7 @@ const { chromium } = require('@playwright/test'); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/debug.mdx b/nodejs/docs/debug.mdx index 4e9402c4d8..3bc8504bab 100644 --- a/nodejs/docs/debug.mdx +++ b/nodejs/docs/debug.mdx @@ -349,6 +349,7 @@ await chromium.launch({ headless: false, slowMo: 100 }); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/dialogs.mdx b/nodejs/docs/dialogs.mdx index 861a12d0c9..f4edfc81e2 100644 --- a/nodejs/docs/dialogs.mdx +++ b/nodejs/docs/dialogs.mdx @@ -102,6 +102,7 @@ This will wait for the print dialog to be opened after the button is clicked. Ma [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/docker.mdx b/nodejs/docs/docker.mdx index 1fdd5d7137..25735df6ef 100644 --- a/nodejs/docs/docker.mdx +++ b/nodejs/docs/docker.mdx @@ -22,7 +22,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright:v1.57.0-noble +docker pull mcr.microsoft.com/playwright:v1.58.0-noble ``` ### Run the image @@ -34,7 +34,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.57.0-noble /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.58.0-noble /bin/bash ``` #### Crawling and scraping @@ -42,7 +42,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.57.0-noble /bin/b On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.57.0-noble /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.58.0-noble /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -82,7 +82,7 @@ You can run Playwright Server in Docker while keeping your tests running on the Start the Playwright Server in Docker: ```bash -docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.57.0-noble /bin/sh -c "npx -y playwright@1.57.0 run-server --port 3000 --host 0.0.0.0" +docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.58.0-noble /bin/sh -c "npx -y playwright@1.58.0 run-server --port 3000 --host 0.0.0.0" ``` #### Connecting to the Server @@ -105,7 +105,7 @@ const browser = await playwright['chromium'].connect('ws://127.0.0.1:3000/'); If you need to access local servers from within the Docker container: ```bash -docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.57.0-noble /bin/sh -c "npx -y playwright@1.57.0 run-server --port 3000 --host 0.0.0.0" +docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.58.0-noble /bin/sh -c "npx -y playwright@1.58.0 run-server --port 3000 --host 0.0.0.0" ``` This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers. @@ -138,9 +138,9 @@ Once this is enabled you can open the port specified in a new browser tab and yo See [all available image tags]. We currently publish images with the following tags: -- `:v1.57.0` - Playwright v1.57.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.57.0-noble` - Playwright v1.57.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.57.0-jammy` - Playwright v1.57.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.58.0` - Playwright v1.58.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.58.0-noble` - Playwright v1.58.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.58.0-jammy` - Playwright v1.58.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). :::note @@ -164,7 +164,7 @@ To run Playwright inside Docker, you need to have Node.js, [Playwright browsers] ```Dockerfile FROM node:20-bookworm -RUN npx -y playwright@1.57.0 install --with-deps +RUN npx -y playwright@1.58.0 install --with-deps ``` @@ -201,6 +201,7 @@ RUN npx -y playwright@1.57.0 install --with-deps [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/downloads.mdx b/nodejs/docs/downloads.mdx index 6c718242a2..82abba533c 100644 --- a/nodejs/docs/downloads.mdx +++ b/nodejs/docs/downloads.mdx @@ -78,6 +78,7 @@ For uploading files, see the [uploading files](./input.mdx#upload-files) section [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/emulation.mdx b/nodejs/docs/emulation.mdx index 3027d5c085..d2e25119f5 100644 --- a/nodejs/docs/emulation.mdx +++ b/nodejs/docs/emulation.mdx @@ -628,6 +628,7 @@ const context = await browser.newContext({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/evaluating.mdx b/nodejs/docs/evaluating.mdx index bf905a66d5..d391a59e69 100644 --- a/nodejs/docs/evaluating.mdx +++ b/nodejs/docs/evaluating.mdx @@ -171,6 +171,7 @@ test.beforeEach(async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/events.mdx b/nodejs/docs/events.mdx index bf1cc813d0..89078f875f 100644 --- a/nodejs/docs/events.mdx +++ b/nodejs/docs/events.mdx @@ -91,6 +91,7 @@ await page.evaluate("prompt('Enter a number:')"); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/extensibility.mdx b/nodejs/docs/extensibility.mdx index ed0f2eed75..f1bb876f51 100644 --- a/nodejs/docs/extensibility.mdx +++ b/nodejs/docs/extensibility.mdx @@ -98,6 +98,7 @@ test('selector engine test', async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/frames.mdx b/nodejs/docs/frames.mdx index be2073fac3..beb4286b3c 100644 --- a/nodejs/docs/frames.mdx +++ b/nodejs/docs/frames.mdx @@ -67,6 +67,7 @@ await frame.fill('#username-input', 'John'); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/getting-started-vscode.mdx b/nodejs/docs/getting-started-vscode.mdx index f599664a28..2f3acf27c2 100644 --- a/nodejs/docs/getting-started-vscode.mdx +++ b/nodejs/docs/getting-started-vscode.mdx @@ -177,6 +177,7 @@ If you have multiple `playwright.config.ts` files, you can switch between them u [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/handles.mdx b/nodejs/docs/handles.mdx index d2f37d6070..ac04b1f931 100644 --- a/nodejs/docs/handles.mdx +++ b/nodejs/docs/handles.mdx @@ -151,6 +151,7 @@ await locator.click(); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/input.mdx b/nodejs/docs/input.mdx index 923e4bb530..f7205dde1d 100644 --- a/nodejs/docs/input.mdx +++ b/nodejs/docs/input.mdx @@ -298,6 +298,7 @@ await page.getByTestId('scrolling-container').evaluate(e => e.scrollTop += 100); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/intro.mdx b/nodejs/docs/intro.mdx index 62ab626b18..7b7842a18d 100644 --- a/nodejs/docs/intro.mdx +++ b/nodejs/docs/intro.mdx @@ -303,6 +303,7 @@ pnpm exec playwright --version [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/languages.mdx b/nodejs/docs/languages.mdx index bfe63c9f2a..2c74e6459b 100644 --- a/nodejs/docs/languages.mdx +++ b/nodejs/docs/languages.mdx @@ -68,6 +68,7 @@ Playwright for .NET comes with MSTest, NUnit, xUnit, and xUnit v3 [base classes] [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/library.mdx b/nodejs/docs/library.mdx index d01a5464cd..a355947e1c 100644 --- a/nodejs/docs/library.mdx +++ b/nodejs/docs/library.mdx @@ -455,6 +455,7 @@ let page: import('playwright').Page; [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/locators.mdx b/nodejs/docs/locators.mdx index f80f9209fc..017a364946 100644 --- a/nodejs/docs/locators.mdx +++ b/nodejs/docs/locators.mdx @@ -949,6 +949,7 @@ For less commonly used locators, look at the [other locators](./other-locators.m [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/mock-browser.mdx b/nodejs/docs/mock-browser.mdx index 1b91f069e9..85fe84f4e5 100644 --- a/nodejs/docs/mock-browser.mdx +++ b/nodejs/docs/mock-browser.mdx @@ -198,6 +198,7 @@ test('update battery status (no golden)', async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/mock.mdx b/nodejs/docs/mock.mdx index fbb2fd2e2d..1c5badec2d 100644 --- a/nodejs/docs/mock.mdx +++ b/nodejs/docs/mock.mdx @@ -201,6 +201,7 @@ For more details, see [WebSocketRoute]. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/navigations.mdx b/nodejs/docs/navigations.mdx index 47680b551e..ffb7a60044 100644 --- a/nodejs/docs/navigations.mdx +++ b/nodejs/docs/navigations.mdx @@ -110,6 +110,7 @@ Playwright splits the process of showing a new document in a page into **navigat [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/network.mdx b/nodejs/docs/network.mdx index 40608a2a90..f144d41ebd 100644 --- a/nodejs/docs/network.mdx +++ b/nodejs/docs/network.mdx @@ -375,6 +375,7 @@ If you're interested in not solely using Service Workers for testing and network [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/other-locators.mdx b/nodejs/docs/other-locators.mdx index bf0b94ee80..092953389d 100644 --- a/nodejs/docs/other-locators.mdx +++ b/nodejs/docs/other-locators.mdx @@ -222,85 +222,6 @@ Alternatively, if you cannot find a suitable locator for the parent element, use const parent = page.getByText('Hello').locator('xpath=..'); ``` -## React locator - -:::note - -React locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -React locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In React locator, component names are transcribed with **CamelCase**. - -```js -await page.locator('_react=BookItem').click(); -``` - -More examples: -- match by **component**: `_react=BookItem` -- match by component and **exact property value**, case-sensitive: `_react=BookItem[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_react=[author = "steven king" i]` -- match by component and **truthy property value**: `_react=MyButton[enabled]` -- match by component and **boolean value**: `_react=MyButton[enabled = false]` -- match by property **value substring**: `_react=[author *= "King"]` -- match by component and **multiple properties**: `_react=BookItem[author *= "king" i][year = 1990]` -- match by **nested** property value: `_react=[some.nested.value = 12]` -- match by component and property value **prefix**: `_react=BookItem[author ^= "Steven"]` -- match by component and property value **suffix**: `_react=BookItem[author $= "Steven"]` -- match by component and **key**: `_react=BookItem[key = '2']` -- match by property value **regex**: `_react=[author = /Steven(\\s+King)?/i]` - -To find React element names in a tree use [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi). - -:::note - -React locator supports React 15 and above. -::: - -:::note -React locator, as well as [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - -## Vue locator - -:::note - -Vue locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -Vue locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In Vue locator, component names are transcribed with **kebab-case**. - -```js -await page.locator('_vue=book-item').click(); -``` - -More examples: -- match by **component**: `_vue=book-item` -- match by component and **exact property value**, case-sensitive: `_vue=book-item[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_vue=[author = "steven king" i]` -- match by component and **truthy property value**: `_vue=my-button[enabled]` -- match by component and **boolean value**: `_vue=my-button[enabled = false]` -- match by property **value substring**: `_vue=[author *= "King"]` -- match by component and **multiple properties**: `_vue=book-item[author *= "king" i][year = 1990]` -- match by **nested** property value: `_vue=[some.nested.value = 12]` -- match by component and property value **prefix**: `_vue=book-item[author ^= "Steven"]` -- match by component and property value **suffix**: `_vue=book-item[author $= "Steven"]` -- match by property value **regex**: `_vue=[author = /Steven(\\s+King)?/i]` - -To find Vue element names in a tree use [Vue DevTools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en). - -:::note - -Vue locator supports Vue2 and above. -::: - -:::note -Vue locator, as well as [Vue DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - ## XPath locator :::warning @@ -507,6 +428,7 @@ For example, `css=article >> text=Hello` captures the element with the text `Hel [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/pages.mdx b/nodejs/docs/pages.mdx index e6fe007a76..a32c565c46 100644 --- a/nodejs/docs/pages.mdx +++ b/nodejs/docs/pages.mdx @@ -124,6 +124,7 @@ page.on('popup', async popup => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/pom.mdx b/nodejs/docs/pom.mdx index b2e7398f23..9e5541d9c2 100644 --- a/nodejs/docs/pom.mdx +++ b/nodejs/docs/pom.mdx @@ -200,6 +200,7 @@ await expect(playwrightDev.tocList).toHaveText([ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/protractor.mdx b/nodejs/docs/protractor.mdx index c46a73becc..e55b9131c6 100644 --- a/nodejs/docs/protractor.mdx +++ b/nodejs/docs/protractor.mdx @@ -200,6 +200,7 @@ Learn more about Playwright Test runner: [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/puppeteer.mdx b/nodejs/docs/puppeteer.mdx index 53810f6e7b..702f4ffdce 100644 --- a/nodejs/docs/puppeteer.mdx +++ b/nodejs/docs/puppeteer.mdx @@ -205,6 +205,7 @@ Learn more about Playwright Test runner: [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/release-notes.mdx b/nodejs/docs/release-notes.mdx index e0b9e6179b..9e850c9b62 100644 --- a/nodejs/docs/release-notes.mdx +++ b/nodejs/docs/release-notes.mdx @@ -2810,7 +2810,7 @@ await locator.click(); Learn more in the [documentation](./api/class-locator). -#### 🧩 Experimental [**React**](./other-locators.mdx#react-locator) and [**Vue**](./other-locators.mdx#vue-locator) selector engines +#### 🧩 Experimental [**React**](./other-locators.mdx) and [**Vue**](./other-locators.mdx) selector engines React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to [attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all attribute selector operators. @@ -2819,7 +2819,7 @@ await page.locator('_react=SubmitButton[enabled=true]').click(); await page.locator('_vue=submit-button[enabled=true]').click(); ``` -Learn more in the [react selectors documentation](./other-locators.mdx#react-locator) and the [vue selectors documentation](./other-locators.mdx#vue-locator). +Learn more in the [react selectors documentation](./other-locators.mdx) and the [vue selectors documentation](./other-locators.mdx). #### ✨ New [**`nth`**](./other-locators.mdx#n-th-element-locator) and [**`visible`**](./other-locators.mdx#css-matching-only-visible-elements) selector engines - [`nth`](./other-locators.mdx#n-th-element-locator) selector engine is equivalent to the `:nth-match` pseudo class, but could be combined with other selector engines. @@ -3195,6 +3195,7 @@ This version of Playwright was also tested against the following stable channels [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/running-tests.mdx b/nodejs/docs/running-tests.mdx index 06cb7ba559..60ad9137b9 100644 --- a/nodejs/docs/running-tests.mdx +++ b/nodejs/docs/running-tests.mdx @@ -205,6 +205,7 @@ You can filter and search for tests as well as click on each test to see the tes [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/screenshots.mdx b/nodejs/docs/screenshots.mdx index ecfa6bc12f..91f913c6bb 100644 --- a/nodejs/docs/screenshots.mdx +++ b/nodejs/docs/screenshots.mdx @@ -75,6 +75,7 @@ await page.locator('.header').screenshot({ path: 'screenshot.png' }); [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/selenium-grid.mdx b/nodejs/docs/selenium-grid.mdx index 27b453330d..5a0a41842d 100644 --- a/nodejs/docs/selenium-grid.mdx +++ b/nodejs/docs/selenium-grid.mdx @@ -157,6 +157,7 @@ This means that Selenium 3 is supported in a best-effort manner, where Playwrigh [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/service-workers.mdx b/nodejs/docs/service-workers.mdx index a88f0bf656..a613b74d71 100644 --- a/nodejs/docs/service-workers.mdx +++ b/nodejs/docs/service-workers.mdx @@ -163,6 +163,7 @@ Requests for updated Service Worker main script code currently cannot be routed [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-agents.mdx b/nodejs/docs/test-agents.mdx index cc59f03d0c..381361eed2 100644 --- a/nodejs/docs/test-agents.mdx +++ b/nodejs/docs/test-agents.mdx @@ -287,6 +287,7 @@ Seed tests provide a ready-to-use `page` context to bootstrap execution. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-annotations.mdx b/nodejs/docs/test-annotations.mdx index ce3c103295..4c12403748 100644 --- a/nodejs/docs/test-annotations.mdx +++ b/nodejs/docs/test-annotations.mdx @@ -351,6 +351,7 @@ test('example test', async ({ page, browser }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-assertions.mdx b/nodejs/docs/test-assertions.mdx index 631f1f34bb..749e8bd57c 100644 --- a/nodejs/docs/test-assertions.mdx +++ b/nodejs/docs/test-assertions.mdx @@ -393,6 +393,7 @@ test('passes', async ({ database }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-cli.mdx b/nodejs/docs/test-cli.mdx index 2ef65fb26b..8aaeec4b99 100644 --- a/nodejs/docs/test-cli.mdx +++ b/nodejs/docs/test-cli.mdx @@ -363,6 +363,7 @@ npx playwright clear-cache [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-components.mdx b/nodejs/docs/test-components.mdx index 95af452210..73c246f1b3 100644 --- a/nodejs/docs/test-components.mdx +++ b/nodejs/docs/test-components.mdx @@ -891,6 +891,7 @@ Accessing a component's internal methods or its instance within test code is nei [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-configuration.mdx b/nodejs/docs/test-configuration.mdx index 597ebdbbd8..e97413d59c 100644 --- a/nodejs/docs/test-configuration.mdx +++ b/nodejs/docs/test-configuration.mdx @@ -187,6 +187,7 @@ export default defineConfig({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-fixtures.mdx b/nodejs/docs/test-fixtures.mdx index 5a99d045d7..54b7fd4908 100644 --- a/nodejs/docs/test-fixtures.mdx +++ b/nodejs/docs/test-fixtures.mdx @@ -890,6 +890,7 @@ Note that the fixtures will still run once per [worker process](./test-parallel. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-global-setup-teardown.mdx b/nodejs/docs/test-global-setup-teardown.mdx index 8414a7a96a..292955d8bd 100644 --- a/nodejs/docs/test-global-setup-teardown.mdx +++ b/nodejs/docs/test-global-setup-teardown.mdx @@ -308,6 +308,7 @@ export default globalSetup; [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-parallel.mdx b/nodejs/docs/test-parallel.mdx index cef7dc04e7..81b3483127 100644 --- a/nodejs/docs/test-parallel.mdx +++ b/nodejs/docs/test-parallel.mdx @@ -316,6 +316,7 @@ Do not define your tests directly in a helper file. This could lead to unexpecte [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-parameterize.mdx b/nodejs/docs/test-parameterize.mdx index 0a164ce8a7..caa783e4b2 100644 --- a/nodejs/docs/test-parameterize.mdx +++ b/nodejs/docs/test-parameterize.mdx @@ -453,6 +453,7 @@ for (const record of records) { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-projects.mdx b/nodejs/docs/test-projects.mdx index 0a20022243..11e228fe41 100644 --- a/nodejs/docs/test-projects.mdx +++ b/nodejs/docs/test-projects.mdx @@ -260,6 +260,7 @@ Projects can be also used to parametrize tests with your custom configuration - [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-reporters.mdx b/nodejs/docs/test-reporters.mdx index 703d330d8d..ea1220db44 100644 --- a/nodejs/docs/test-reporters.mdx +++ b/nodejs/docs/test-reporters.mdx @@ -531,6 +531,7 @@ Here's a short list of open source reporter implementations that you can take a [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-retries.mdx b/nodejs/docs/test-retries.mdx index 92f13d6336..3516869573 100644 --- a/nodejs/docs/test-retries.mdx +++ b/nodejs/docs/test-retries.mdx @@ -276,6 +276,7 @@ test('runs second', async () => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-sharding.mdx b/nodejs/docs/test-sharding.mdx index cfc3e82b1e..50922f265a 100644 --- a/nodejs/docs/test-sharding.mdx +++ b/nodejs/docs/test-sharding.mdx @@ -243,6 +243,7 @@ Supported options: [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-snapshots.mdx b/nodejs/docs/test-snapshots.mdx index f0bfe05857..9fc1bd28fc 100644 --- a/nodejs/docs/test-snapshots.mdx +++ b/nodejs/docs/test-snapshots.mdx @@ -173,6 +173,7 @@ Snapshots are stored next to the test file, in a separate directory. For example [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-timeouts.mdx b/nodejs/docs/test-timeouts.mdx index 91912dba98..d2a559db00 100644 --- a/nodejs/docs/test-timeouts.mdx +++ b/nodejs/docs/test-timeouts.mdx @@ -244,6 +244,7 @@ API reference: [test.extend()](/api/class-test.mdx#test-extend). [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-typescript.mdx b/nodejs/docs/test-typescript.mdx index eb9cc49fcc..27ece05860 100644 --- a/nodejs/docs/test-typescript.mdx +++ b/nodejs/docs/test-typescript.mdx @@ -172,6 +172,7 @@ Then `npm run test` will build the tests and run them. [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-ui-mode.mdx b/nodejs/docs/test-ui-mode.mdx index 5c80d026ef..b910d4f0a5 100644 --- a/nodejs/docs/test-ui-mode.mdx +++ b/nodejs/docs/test-ui-mode.mdx @@ -164,6 +164,7 @@ Be aware that when specifying the `--ui-host=0.0.0.0` flag, UI Mode with your tr [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-use-options.mdx b/nodejs/docs/test-use-options.mdx index a0e452978a..74540a81eb 100644 --- a/nodejs/docs/test-use-options.mdx +++ b/nodejs/docs/test-use-options.mdx @@ -381,6 +381,7 @@ test('no base url', async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/test-webserver.mdx b/nodejs/docs/test-webserver.mdx index 94839ab970..3bdf84f3f5 100644 --- a/nodejs/docs/test-webserver.mdx +++ b/nodejs/docs/test-webserver.mdx @@ -165,6 +165,7 @@ export default defineConfig({ [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/testing-library.mdx b/nodejs/docs/testing-library.mdx index b35111e9fb..aa02dfa3bf 100644 --- a/nodejs/docs/testing-library.mdx +++ b/nodejs/docs/testing-library.mdx @@ -188,6 +188,7 @@ Learn more about Playwright Test runner: [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/touch-events.mdx b/nodejs/docs/touch-events.mdx index c7501a9482..dbea4d83e4 100644 --- a/nodejs/docs/touch-events.mdx +++ b/nodejs/docs/touch-events.mdx @@ -176,6 +176,7 @@ test(`pinch in gesture to zoom out the map`, async ({ page }) => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/trace-viewer-intro.mdx b/nodejs/docs/trace-viewer-intro.mdx index 9b5b131532..183c4e1e55 100644 --- a/nodejs/docs/trace-viewer-intro.mdx +++ b/nodejs/docs/trace-viewer-intro.mdx @@ -108,6 +108,7 @@ To learn more about traces, check out our detailed guide on [Trace Viewer](/trac [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/trace-viewer.mdx b/nodejs/docs/trace-viewer.mdx index d37b31739a..aeb98ff0f4 100644 --- a/nodejs/docs/trace-viewer.mdx +++ b/nodejs/docs/trace-viewer.mdx @@ -245,6 +245,7 @@ The "Attachments" tab allows you to explore attachments. If you're doing [visual [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/videos.mdx b/nodejs/docs/videos.mdx index dfe44e9398..008ec45725 100644 --- a/nodejs/docs/videos.mdx +++ b/nodejs/docs/videos.mdx @@ -136,6 +136,7 @@ Note that the video is only available after the page or browser context is close [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/webview2.mdx b/nodejs/docs/webview2.mdx index 9cb66f8aac..ee885bf612 100644 --- a/nodejs/docs/webview2.mdx +++ b/nodejs/docs/webview2.mdx @@ -151,6 +151,7 @@ For debugging tests, see the Playwright [Debugging guide](./debug). [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/nodejs/docs/writing-tests.mdx b/nodejs/docs/writing-tests.mdx index a6f85bef23..bd58503cea 100644 --- a/nodejs/docs/writing-tests.mdx +++ b/nodejs/docs/writing-tests.mdx @@ -204,6 +204,7 @@ test.describe('navigation', () => { [Logger]: /api/class-logger.mdx "Logger" [Mouse]: /api/class-mouse.mdx "Mouse" [Page]: /api/class-page.mdx "Page" +[PageAgent]: /api/class-pageagent.mdx "PageAgent" [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" [Playwright]: /api/class-playwright.mdx "Playwright" [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" diff --git a/python/docs/other-locators.mdx b/python/docs/other-locators.mdx index 92b1b7ae1c..0713cac44b 100644 --- a/python/docs/other-locators.mdx +++ b/python/docs/other-locators.mdx @@ -497,125 +497,6 @@ parent = page.get_by_text("Hello").locator('xpath=..') -## React locator - -:::note - -React locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -React locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In React locator, component names are transcribed with **CamelCase**. - - - - -```py -page.locator("_react=BookItem").click() -``` - - - - -```py -await page.locator("_react=BookItem").click() -``` - - - - -More examples: -- match by **component**: `_react=BookItem` -- match by component and **exact property value**, case-sensitive: `_react=BookItem[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_react=[author = "steven king" i]` -- match by component and **truthy property value**: `_react=MyButton[enabled]` -- match by component and **boolean value**: `_react=MyButton[enabled = false]` -- match by property **value substring**: `_react=[author *= "King"]` -- match by component and **multiple properties**: `_react=BookItem[author *= "king" i][year = 1990]` -- match by **nested** property value: `_react=[some.nested.value = 12]` -- match by component and property value **prefix**: `_react=BookItem[author ^= "Steven"]` -- match by component and property value **suffix**: `_react=BookItem[author $= "Steven"]` -- match by component and **key**: `_react=BookItem[key = '2']` -- match by property value **regex**: `_react=[author = /Steven(\\s+King)?/i]` - -To find React element names in a tree use [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi). - -:::note - -React locator supports React 15 and above. -::: - -:::note -React locator, as well as [React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - -## Vue locator - -:::note - -Vue locator is experimental and prefixed with `_`. The functionality might change in future. -::: - -Vue locator allows finding elements by their component name and property values. The syntax is very similar to [CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all CSS attribute selector operators. - -In Vue locator, component names are transcribed with **kebab-case**. - - - - -```py -page.locator("_vue=book-item").click() -``` - - - - -```py -await page.locator("_vue=book-item").click() -``` - - - - -More examples: -- match by **component**: `_vue=book-item` -- match by component and **exact property value**, case-sensitive: `_vue=book-item[author = "Steven King"]` -- match by property value only, **case-insensitive**: `_vue=[author = "steven king" i]` -- match by component and **truthy property value**: `_vue=my-button[enabled]` -- match by component and **boolean value**: `_vue=my-button[enabled = false]` -- match by property **value substring**: `_vue=[author *= "King"]` -- match by component and **multiple properties**: `_vue=book-item[author *= "king" i][year = 1990]` -- match by **nested** property value: `_vue=[some.nested.value = 12]` -- match by component and property value **prefix**: `_vue=book-item[author ^= "Steven"]` -- match by component and property value **suffix**: `_vue=book-item[author $= "Steven"]` -- match by property value **regex**: `_vue=[author = /Steven(\\s+King)?/i]` - -To find Vue element names in a tree use [Vue DevTools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en). - -:::note - -Vue locator supports Vue2 and above. -::: - -:::note -Vue locator, as well as [Vue DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi), only work against **unminified** application builds. -::: - ## XPath locator :::warning diff --git a/python/docs/release-notes.mdx b/python/docs/release-notes.mdx index 4e812e15f8..cc7f23258e 100644 --- a/python/docs/release-notes.mdx +++ b/python/docs/release-notes.mdx @@ -1678,7 +1678,7 @@ locator.click() Learn more in the [documentation](./api/class-locator). -#### 🧩 Experimental [**React**](./other-locators.mdx#react-locator) and [**Vue**](./other-locators.mdx#vue-locator) selector engines +#### 🧩 Experimental [**React**](./other-locators.mdx) and [**Vue**](./other-locators.mdx) selector engines React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to [attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) and supports all attribute selector operators. @@ -1687,7 +1687,7 @@ page.locator("_react=SubmitButton[enabled=true]").click() page.locator("_vue=submit-button[enabled=true]").click() ``` -Learn more in the [react selectors documentation](./other-locators.mdx#react-locator) and the [vue selectors documentation](./other-locators.mdx#vue-locator). +Learn more in the [react selectors documentation](./other-locators.mdx) and the [vue selectors documentation](./other-locators.mdx). #### ✨ New [**`nth`**](./other-locators.mdx#n-th-element-locator) and [**`visible`**](./other-locators.mdx#css-matching-only-visible-elements) selector engines - [`nth`](./other-locators.mdx#n-th-element-locator) selector engine is equivalent to the `:nth-match` pseudo class, but could be combined with other selector engines. diff --git a/src/api_parser.js b/src/api_parser.js index d7fc1a7fca..0718ccb492 100644 --- a/src/api_parser.js +++ b/src/api_parser.js @@ -93,9 +93,6 @@ class ApiParser { if (!match) throw new Error('Invalid member: ' + spec.text); const metainfo = extractMetainfo(spec); - if (metainfo.hidden) - return; - const name = match[3]; let returnType = null; let optional = false; @@ -128,6 +125,8 @@ class ApiParser { const clazz = /** @type {docs.Class} */(this.classes.get(match[2])); if (!clazz) throw new Error(`Unknown class ${match[2]} for member: ` + spec.text); + if (metainfo.hidden) + return; const existingMember = clazz.membersArray.find(m => m.name === name && m.kind === member.kind); if (existingMember && isTypeOverride(existingMember, member)) { @@ -147,9 +146,6 @@ class ApiParser { const match = spec.text.match(/(param|option): (.*)/); if (!match) throw `Something went wrong with matching ${spec.text}`; - const metainfo = extractMetainfo(spec); - if (metainfo.hidden) - return null; // For "test.describe.only.title": // - className is "test"