Skip to content

Commit 9e034c5

Browse files
feat(roll): roll to ToT Playwright (08-12-25) (#1940)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
1 parent 5760a55 commit 9e034c5

File tree

11 files changed

+182
-7
lines changed

11 files changed

+182
-7
lines changed

dotnet/docs/docker.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ This makes `hostmachine` point to the host's localhost. Your tests should use `h
109109
When running tests remotely, ensure the Playwright version in your tests matches the version running in the Docker container.
110110
:::
111111

112+
### Connecting using noVNC and GitHub Codespaces
113+
114+
For Docker and GitHub Codespaces environments, you can view and generate tests using the `noVNC` viewer built into the Docker image. In order for the VNC webviewer to be accessible outside of the container, you can enable the `desktop-lite` feature and specify the `webPort` in your `.devcontainer/devcontainer.json` file:
115+
116+
```json
117+
{
118+
"image": "mcr.microsoft.com/playwright:v1.57.0",
119+
"forwardPorts": [6080],
120+
"features": {
121+
"desktop-lite": {
122+
"webPort": "6080"
123+
}
124+
}
125+
}
126+
```
127+
128+
Once this is enabled you can open the port specified in a new browser tab and you will have access to the `noVNC` web viewer. This will enable you to record tests, pick selectors, and use codegen directly on your container.
129+
112130
## Image tags
113131

114132
See [all available image tags].

java/docs/clock.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Often you only need to fake `Date.now` while keeping the timers going. That way
5959
```
6060

6161
```java
62-
SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
62+
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
6363
page.clock().setFixedTime(format.parse("2024-02-02T10:00:00"));
6464
page.navigate("http://localhost:3333");
6565
Locator locator = page.getByTestId("current-time");
@@ -87,7 +87,7 @@ Sometimes your timers depend on `Date.now` and are confused when the `Date.now`
8787
```java
8888
// Initialize clock with some time before the test time and let the page load
8989
// naturally. `Date.now` will progress as the timers fire.
90-
SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
90+
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
9191
page.clock().install(new Clock.InstallOptions().setTime(format.parse("2024-02-02T08:00:00")));
9292
page.navigate("http://localhost:3333");
9393
Locator locator = page.getByTestId("current-time");
@@ -162,7 +162,7 @@ In rare cases, you may want to tick through time manually, firing all timers and
162162
```
163163

164164
```java
165-
SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
165+
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
166166
// Initialize clock with a specific time, let the page load naturally.
167167
page.clock().install(new Clock.InstallOptions()
168168
.setTime(format.parse("2024-02-02T08:00:00")));

java/docs/docker.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,24 @@ This makes `hostmachine` point to the host's localhost. Your tests should use `h
117117
When running tests remotely, ensure the Playwright version in your tests matches the version running in the Docker container.
118118
:::
119119

120+
### Connecting using noVNC and GitHub Codespaces
121+
122+
For Docker and GitHub Codespaces environments, you can view and generate tests using the `noVNC` viewer built into the Docker image. In order for the VNC webviewer to be accessible outside of the container, you can enable the `desktop-lite` feature and specify the `webPort` in your `.devcontainer/devcontainer.json` file:
123+
124+
```json
125+
{
126+
"image": "mcr.microsoft.com/playwright:v1.57.0",
127+
"forwardPorts": [6080],
128+
"features": {
129+
"desktop-lite": {
130+
"webPort": "6080"
131+
}
132+
}
133+
}
134+
```
135+
136+
Once this is enabled you can open the port specified in a new browser tab and you will have access to the `noVNC` web viewer. This will enable you to record tests, pick selectors, and use codegen directly on your container.
137+
120138
## Image tags
121139

122140
See [all available image tags].

java/docs/input.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ page.getByRole(AriaRole.TEXTBOX).fill("Peter");
2222
page.getByLabel("Birth date").fill("2020-02-02");
2323

2424
// Time input
25-
page.getByLabel("Appointment time").fill("13-15");
25+
page.getByLabel("Appointment time").fill("13:15");
2626

2727
// Local datetime input
2828
page.getByLabel("Local time").fill("2020-03-02T05:15");
@@ -37,7 +37,7 @@ Using [Locator.setChecked()](/api/class-locator.mdx#locator-set-checked) is the
3737
page.getByLabel("I agree to the terms above").check();
3838

3939
// Assert the checked state
40-
assertTrue(page.getByLabel("Subscribe to newsletter")).isChecked();
40+
assertThat(page.getByLabel("Subscribe to newsletter")).isChecked();
4141

4242
// Select the radio button
4343
page.getByLabel("XL").check();

java/docs/locators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ rowLocator
878878
.setHas(page.getByRole(
879879
AriaRole.BUTTON,
880880
new Page.GetByRoleOptions().setName("Say goodbye"))))
881-
.screenshot(new Page.ScreenshotOptions().setPath("screenshot.png"));
881+
.screenshot(new Locator.ScreenshotOptions().setPath(Paths.get("screenshot.png")));
882882
```
883883

884884
You should now have a "screenshot.png" file in your project's root directory.

nodejs/docs/api/class-browser.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,21 @@ If directly using this method to create [BrowserContext]s, it is best practice t
168168
- `acceptDownloads` [boolean] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-new-context-option-accept-downloads"/><a href="#browser-new-context-option-accept-downloads" class="list-anchor">#</a>
169169

170170
Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.
171+
- `agent` [Object] *(optional)* <font size="2">Added in: v1.58</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-new-context-option-agent"/><a href="#browser-new-context-option-agent" class="list-anchor">#</a>
172+
- `provider` [string]
173+
174+
LLM provider to use
175+
- `model` [string]
176+
177+
Model identifier within provider
178+
- `cacheFile` [string] *(optional)*
179+
180+
Cache file to use/generate code for performed actions into. Cache is not used if not specified (default).
181+
- `cacheMode` ['force'] | ['ignore'] | ['auto'] *(optional)*
182+
183+
Cache control, defauls to 'auto'
184+
185+
Agent settings for [page.perform()](/api/class-page.mdx#page-perform) and [page.extract()](/api/class-page.mdx#page-extract).
171186
- `baseURL` [string] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-new-context-option-base-url"/><a href="#browser-new-context-option-base-url" class="list-anchor">#</a>
172187

173188
When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples:

nodejs/docs/api/class-page.mdx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,36 @@ const crypto = require('crypto');
701701

702702
---
703703

704+
### extract {#page-extract}
705+
706+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.58</font><x-search>page.extract</x-search>
707+
708+
Extract information from the page using the agentic loop, return it in a given Zod format.
709+
710+
**Usage**
711+
712+
```js
713+
await page.extract('List of items in the cart', z.object({
714+
title: z.string().describe('Item title to extract'),
715+
price: z.string().describe('Item price to extract'),
716+
}).array());
717+
```
718+
719+
**Arguments**
720+
- `query` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-extract-option-query"/><a href="#page-extract-option-query" class="list-anchor">#</a>
721+
722+
Task to perform using agentic loop.
723+
- `schema` [z.ZodSchema]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-extract-option-schema"/><a href="#page-extract-option-schema" class="list-anchor">#</a>
724+
- `options` [Object] *(optional)*
725+
- `maxTurns` [number] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-extract-option-max-turns"/><a href="#page-extract-option-max-turns" class="list-anchor">#</a>
726+
727+
Maximum number of agentic steps to take while extracting the information.
728+
729+
**Returns**
730+
- [Promise]&lt;[Object]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-extract-return"/><a href="#page-extract-return" class="list-anchor">#</a>
731+
732+
---
733+
704734
### frame {#page-frame}
705735

706736
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>page.frame</x-search>
@@ -1485,6 +1515,35 @@ The [format](/api/class-page.mdx#page-pdf-option-format) options are:
14851515

14861516
---
14871517

1518+
### perform {#page-perform}
1519+
1520+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.58</font><x-search>page.perform</x-search>
1521+
1522+
Perform action using agentic loop.
1523+
1524+
**Usage**
1525+
1526+
```js
1527+
await page.perform('Click submit button');
1528+
```
1529+
1530+
**Arguments**
1531+
- `task` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-perform-option-task"/><a href="#page-perform-option-task" class="list-anchor">#</a>
1532+
1533+
Task to perform using agentic loop.
1534+
- `options` [Object] *(optional)*
1535+
- `key` [string] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-perform-option-key"/><a href="#page-perform-option-key" class="list-anchor">#</a>
1536+
1537+
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.
1538+
- `maxTurns` [number] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-perform-option-max-turns"/><a href="#page-perform-option-max-turns" class="list-anchor">#</a>
1539+
1540+
Maximum number of agentic steps to take while performing this action.
1541+
1542+
**Returns**
1543+
- [Promise]&lt;[void]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-perform-return"/><a href="#page-perform-return" class="list-anchor">#</a>
1544+
1545+
---
1546+
14881547
### reload {#page-reload}
14891548

14901549
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>page.reload</x-search>

nodejs/docs/api/class-testoptions.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,35 @@ Learn more about [various timeouts](../test-timeouts.mdx).
9292

9393
---
9494

95+
### agent {#test-options-agent}
96+
97+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.58</font><x-search>testOptions.agent</x-search>
98+
99+
Agent settings for [page.perform()](/api/class-page.mdx#page-perform) and [page.extract()](/api/class-page.mdx#page-extract).
100+
101+
**Usage**
102+
103+
```js
104+
testOptions.agent
105+
```
106+
107+
**Type**
108+
- [Object]
109+
- `provider` [string]
110+
111+
LLM provider to use
112+
- `model` [string]
113+
114+
Model identifier within provider
115+
- `cacheFile` [string] *(optional)*
116+
117+
Cache file to use/generate code for performed actions into. Cache is not used if not specified (default).
118+
- `cacheMode` ['force'] | ['ignore'] | ['auto'] *(optional)*
119+
120+
Cache control, defauls to 'auto'
121+
122+
---
123+
95124
### baseURL {#test-options-base-url}
96125

97126
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.10</font><x-search>testOptions.baseURL</x-search>

nodejs/docs/docker.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ This makes `hostmachine` point to the host's localhost. Your tests should use `h
115115
When running tests remotely, ensure the Playwright version in your tests matches the version running in the Docker container.
116116
:::
117117

118+
### Connecting using noVNC and GitHub Codespaces
119+
120+
For Docker and GitHub Codespaces environments, you can view and generate tests using the `noVNC` viewer built into the Docker image. In order for the VNC webviewer to be accessible outside of the container, you can enable the `desktop-lite` feature and specify the `webPort` in your `.devcontainer/devcontainer.json` file:
121+
122+
```json
123+
{
124+
"image": "mcr.microsoft.com/playwright:v1.57.0",
125+
"forwardPorts": [6080],
126+
"features": {
127+
"desktop-lite": {
128+
"webPort": "6080"
129+
}
130+
}
131+
}
132+
```
133+
134+
Once this is enabled you can open the port specified in a new browser tab and you will have access to the `noVNC` web viewer. This will enable you to record tests, pick selectors, and use codegen directly on your container.
135+
118136
## Image tags
119137

120138
See [all available image tags].

nodejs/docs/test-ui-mode.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ npx playwright test --ui-port=8080 --ui-host=0.0.0.0
127127
```
128128

129129
:::note
130-
Be aware that when specifying the `--ui-host=0.0.0.0` flag, UI Mode with your traces, the passwords and secrets is accessible from other machines inside your network. In the case of GitHub Codespaces, the ports are only accessible from your account by default.
130+
Be aware that when specifying the `--ui-host=0.0.0.0` flag, UI Mode with your traces, the passwords and secrets are accessible from other machines inside your network. In the case of GitHub Codespaces, the ports are only accessible from your account by default.
131131
:::
132132

133133

0 commit comments

Comments
 (0)