Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions dotnet/versioned_docs/version-stable/api/class-browsertype.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,19 @@ class BrowserTypeExamples

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

This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.

:::note

The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
:::

**Usage**

```csharp
await BrowserType.ConnectAsync(wsEndpoint, options);
await BrowserType.ConnectAsync();
```

**Arguments**
- `wsEndpoint` [string] <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-ws-endpoint"/><a href="#browser-type-connect-option-ws-endpoint" class="list-anchor">#</a>

A browser websocket endpoint to connect to.
- `options` `BrowserTypeConnectOptions?` *(optional)*
- `ExposeNetwork` [string]? *(optional)* <font size="2">Added in: v1.37</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-expose-network"/><a href="#browser-type-connect-option-expose-network" class="list-anchor">#</a>

This option exposes network available on the connecting client to the browser being connected to. Consists of a list of rules separated by comma.

Available rules:
1. Hostname pattern, for example: `example.com`, `*.org:99`, `x.*.y.com`, `*foo.org`.
1. IP literal, for example: `127.0.0.1`, `0.0.0.0:99`, `[::1]`, `[0:0::1]:99`.
1. `<loopback>` that matches local loopback interfaces: `localhost`, `*.localhost`, `127.0.0.1`, `[::1]`.

Some common examples:
1. `"*"` to expose all network.
1. `"<loopback>"` to expose localhost network.
1. `"*.test.internal-domain,*.staging.internal-domain,<loopback>"` to expose test/staging deployments and localhost.
- `Headers` [IDictionary]?&lt;[string], [string]&gt; *(optional)* <font size="2">Added in: v1.11</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-headers"/><a href="#browser-type-connect-option-headers" class="list-anchor">#</a>

Additional HTTP headers to be sent with web socket connect request. Optional.
- `SlowMo` [float]? *(optional)* <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-slow-mo"/><a href="#browser-type-connect-option-slow-mo" class="list-anchor">#</a>

Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
- `Timeout` [float]? *(optional)* <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-timeout"/><a href="#browser-type-connect-option-timeout" class="list-anchor">#</a>

Maximum time in milliseconds to wait for the connection to be established. Defaults to `0` (no timeout).

**Returns**
- [Browser]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-return"/><a href="#browser-type-connect-return" class="list-anchor">#</a>

Expand All @@ -91,6 +68,10 @@ The default browser context is accessible via [Browser.Contexts](/api/class-brow
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
:::

:::note
This connection is significantly lower fidelity than the Playwright protocol connection via [BrowserType.ConnectAsync()](/api/class-browsertype.mdx#browser-type-connect). If you are experiencing issues or attempting to use advanced functionality, you probably want to use [BrowserType.ConnectAsync()](/api/class-browsertype.mdx#browser-type-connect).
:::

**Usage**

```csharp
Expand Down
2 changes: 1 addition & 1 deletion dotnet/versioned_docs/version-stable/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var button = page.GetByRole(AriaRole.Button).And(page.GetByTitle("Subscribe"));

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locator.AriaSnapshotAsync</x-search>

Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) for the corresponding assertion.
Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) for the corresponding assertion.

**Usage**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ await Expect(locator).ToHaveValuesAsync(new Regex[] { new Regex("R"), new Regex(

---

### ToMatchAriaSnapshotAsync {#locator-assertions-to-match-aria-snapshot-1}
### ToMatchAriaSnapshotAsync {#locator-assertions-to-match-aria-snapshot}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locatorAssertions.ToMatchAriaSnapshotAsync</x-search>

Expand All @@ -828,14 +828,14 @@ await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@"
```

**Arguments**
- `expected` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-expected" class="list-anchor">#</a>
- `expected` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-option-expected" class="list-anchor">#</a>
- `options` `LocatorAssertionsToMatchAriaSnapshotOptions?` *(optional)*
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-timeout" class="list-anchor">#</a>
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-option-timeout" class="list-anchor">#</a>

Time to retry the assertion for in milliseconds. Defaults to `5000`.

**Returns**
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-return"/><a href="#locator-assertions-to-match-aria-snapshot-1-return" class="list-anchor">#</a>
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-return"/><a href="#locator-assertions-to-match-aria-snapshot-return" class="list-anchor">#</a>

---

Expand Down
2 changes: 1 addition & 1 deletion dotnet/versioned_docs/version-stable/aria-snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ These values are derived from ARIA attributes or calculated based on HTML semant

## Snapshot matching

The [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) assertion method in Playwright compares the accessible structure of the locator scope with a predefined aria snapshot template, helping validate the page's state against testing requirements.
The [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) assertion method in Playwright compares the accessible structure of the locator scope with a predefined aria snapshot template, helping validate the page's state against testing requirements.

For the following DOM:

Expand Down
2 changes: 1 addition & 1 deletion dotnet/versioned_docs/version-stable/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HTMLCard from '@site/src/components/HTMLCard';

### Aria snapshots

New assertion [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) verifies page structure by comparing to an expected accessibility tree, represented as YAML.
New assertion [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) verifies page structure by comparing to an expected accessibility tree, represented as YAML.

```csharp
await page.GotoAsync("https://playwright.dev");
Expand Down
42 changes: 11 additions & 31 deletions java/versioned_docs/version-stable/api/class-browsertype.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,19 @@ public class Example {

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

This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.

:::note

The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
:::

**Usage**

```java
BrowserType.connect(wsEndpoint);
BrowserType.connect(wsEndpoint, options);
BrowserType.connect();
```

**Arguments**
- `wsEndpoint` [String] <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-ws-endpoint"/><a href="#browser-type-connect-option-ws-endpoint" class="list-anchor">#</a>

A browser websocket endpoint to connect to.
- `options` `BrowserType.ConnectOptions` *(optional)*
- `setExposeNetwork` [String] *(optional)* <font size="2">Added in: v1.37</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-expose-network"/><a href="#browser-type-connect-option-expose-network" class="list-anchor">#</a>

This option exposes network available on the connecting client to the browser being connected to. Consists of a list of rules separated by comma.

Available rules:
1. Hostname pattern, for example: `example.com`, `*.org:99`, `x.*.y.com`, `*foo.org`.
1. IP literal, for example: `127.0.0.1`, `0.0.0.0:99`, `[::1]`, `[0:0::1]:99`.
1. `<loopback>` that matches local loopback interfaces: `localhost`, `*.localhost`, `127.0.0.1`, `[::1]`.

Some common examples:
1. `"*"` to expose all network.
1. `"<loopback>"` to expose localhost network.
1. `"*.test.internal-domain,*.staging.internal-domain,<loopback>"` to expose test/staging deployments and localhost.
- `setHeaders` [Map]&lt;[String], [String]&gt; *(optional)* <font size="2">Added in: v1.11</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-headers"/><a href="#browser-type-connect-option-headers" class="list-anchor">#</a>

Additional HTTP headers to be sent with web socket connect request. Optional.
- `setSlowMo` [double] *(optional)* <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-slow-mo"/><a href="#browser-type-connect-option-slow-mo" class="list-anchor">#</a>

Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
- `setTimeout` [double] *(optional)* <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-timeout"/><a href="#browser-type-connect-option-timeout" class="list-anchor">#</a>

Maximum time in milliseconds to wait for the connection to be established. Defaults to `0` (no timeout).

**Returns**
- [Browser]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-return"/><a href="#browser-type-connect-return" class="list-anchor">#</a>

Expand All @@ -90,6 +66,10 @@ The default browser context is accessible via [Browser.contexts()](/api/class-br
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
:::

:::note
This connection is significantly lower fidelity than the Playwright protocol connection via [BrowserType.connect()](/api/class-browsertype.mdx#browser-type-connect). If you are experiencing issues or attempting to use advanced functionality, you probably want to use [BrowserType.connect()](/api/class-browsertype.mdx#browser-type-connect).
:::

**Usage**

```java
Expand Down
2 changes: 1 addition & 1 deletion java/versioned_docs/version-stable/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Locator button = page.getByRole(AriaRole.BUTTON).and(page.getByTitle("Subscribe"

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locator.ariaSnapshot</x-search>

Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) for the corresponding assertion.
Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) for the corresponding assertion.

**Usage**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ assertThat(

---

### matchesAriaSnapshot {#locator-assertions-to-match-aria-snapshot-1}
### matchesAriaSnapshot {#locator-assertions-to-match-aria-snapshot}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locatorAssertions.matchesAriaSnapshot</x-search>

Expand All @@ -805,14 +805,14 @@ assertThat(page.locator("body")).matchesAriaSnapshot("""
```

**Arguments**
- `expected` [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-expected" class="list-anchor">#</a>
- `expected` [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-option-expected" class="list-anchor">#</a>
- `options` `LocatorAssertions.MatchesAriaSnapshotOptions` *(optional)*
- `setTimeout` [double] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-timeout" class="list-anchor">#</a>
- `setTimeout` [double] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-option-timeout" class="list-anchor">#</a>

Time to retry the assertion for in milliseconds. Defaults to `5000`.

**Returns**
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-return"/><a href="#locator-assertions-to-match-aria-snapshot-1-return" class="list-anchor">#</a>
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-return"/><a href="#locator-assertions-to-match-aria-snapshot-return" class="list-anchor">#</a>

---

Expand Down
2 changes: 1 addition & 1 deletion java/versioned_docs/version-stable/aria-snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ These values are derived from ARIA attributes or calculated based on HTML semant

## Snapshot matching

The [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) assertion method in Playwright compares the accessible structure of the locator scope with a predefined aria snapshot template, helping validate the page's state against testing requirements.
The [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) assertion method in Playwright compares the accessible structure of the locator scope with a predefined aria snapshot template, helping validate the page's state against testing requirements.

For the following DOM:

Expand Down
2 changes: 1 addition & 1 deletion java/versioned_docs/version-stable/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HTMLCard from '@site/src/components/HTMLCard';

### Aria snapshots

New assertion [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) verifies page structure by comparing to an expected accessibility tree, represented as YAML.
New assertion [assertThat(locator).matchesAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) verifies page structure by comparing to an expected accessibility tree, represented as YAML.

```java
page.navigate("https://playwright.dev");
Expand Down
13 changes: 11 additions & 2 deletions nodejs/versioned_docs/version-stable/api/class-browsertype.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.

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

This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
This method attaches Playwright to an existing browser instance created via [browserType.launchServer()](/api/class-browsertype.mdx#browser-type-launch-server).

:::note

The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
:::

**Usage**

Expand All @@ -42,7 +47,7 @@ await browserType.connect(wsEndpoint, options);
**Arguments**
- `wsEndpoint` [string] <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-ws-endpoint"/><a href="#browser-type-connect-option-ws-endpoint" class="list-anchor">#</a>

A browser websocket endpoint to connect to.
A Playwright browser websocket endpoint to connect to. You obtain this endpoint via [browserServer.wsEndpoint()](/api/class-browserserver.mdx#browser-server-ws-endpoint).
- `options` [Object] *(optional)*
- `exposeNetwork` [string] *(optional)* <font size="2">Added in: v1.37</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-expose-network"/><a href="#browser-type-connect-option-expose-network" class="list-anchor">#</a>

Expand Down Expand Up @@ -88,6 +93,10 @@ The default browser context is accessible via [browser.contexts()](/api/class-br
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
:::

:::note
This connection is significantly lower fidelity than the Playwright protocol connection via [browserType.connect()](/api/class-browsertype.mdx#browser-type-connect). If you are experiencing issues or attempting to use advanced functionality, you probably want to use [browserType.connect()](/api/class-browsertype.mdx#browser-type-connect).
:::

**Usage**

```js
Expand Down
2 changes: 1 addition & 1 deletion nodejs/versioned_docs/version-stable/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const button = page.getByRole('button').and(page.getByTitle('Subscribe'));

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locator.ariaSnapshot</x-search>

Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [expect(locator).toMatchAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) for the corresponding assertion.
Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [expect(locator).toMatchAriaSnapshot()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) for the corresponding assertion.

**Usage**

Expand Down
Loading
Loading