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
102 changes: 50 additions & 52 deletions dotnet/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,6 @@ The order of evaluation of multiple scripts installed via [BrowserContext.AddIni

---

### BackgroundPages {#browser-context-background-pages}

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

:::note

Background pages are only supported on Chromium-based browsers.
:::

All existing background pages in the context.

**Usage**

```csharp
BrowserContext.BackgroundPages
```

**Returns**
- [IReadOnlyList]&lt;[Page]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-background-pages-return"/><a href="#browser-context-background-pages-return" class="list-anchor">#</a>

---

### Browser {#browser-context-browser}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browserContext.Browser</x-search>
Expand Down Expand Up @@ -1042,36 +1020,6 @@ BrowserContext.Tracing

## Events

### event BackgroundPage {#browser-context-event-background-page}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browserContext.event BackgroundPage</x-search>

:::note

Only works with Chromium browser's persistent context.
:::

Emitted when new background page is created in the context.

```csharp
context.BackgroundPage += (_, backgroundPage) =>
{
Console.WriteLine(backgroundPage.Url);
};

```

**Usage**

```csharp
BrowserContext.BackgroundPage += async (_, page) => {};
```

**Event data**
- [Page]

---

### event Close {#browser-context-event-close}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browserContext.event Close</x-search>
Expand Down Expand Up @@ -1262,6 +1210,56 @@ BrowserContext.WebError += async (_, webError) => {};
**Event data**
- [WebError]

---

## Deprecated

### event BackgroundPage {#browser-context-event-background-page}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browserContext.event BackgroundPage</x-search>

:::warning Deprecated

Background pages have been removed from Chromium together with Manifest V2 extensions.

:::


This event is not emitted.

**Usage**

```csharp
BrowserContext.BackgroundPage += async (_, page) => {};
```

**Event data**
- [Page]

---

### BackgroundPages {#browser-context-background-pages}

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

:::warning Deprecated

Background pages have been removed from Chromium together with Manifest V2 extensions.

:::


Returns an empty list.

**Usage**

```csharp
BrowserContext.BackgroundPages
```

**Returns**
- [IReadOnlyList]&lt;[Page]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-background-pages-return"/><a href="#browser-context-background-pages-return" class="list-anchor">#</a>


[Accessibility]: /api/class-accessibility.mdx "Accessibility"
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
Expand Down
10 changes: 7 additions & 3 deletions dotnet/docs/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ await Page.CloseAsync(options);

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

Returns up to 200 last console messages from this page. See [Page.Console](/api/class-page.mdx#page-event-console) for more details.
Returns up to (currently) 200 last console messages from this page. See [Page.Console](/api/class-page.mdx#page-event-console) for more details.

**Usage**

Expand Down Expand Up @@ -1332,7 +1332,7 @@ await Page.OpenerAsync();

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

Returns up to 200 last page errors from this page. See [Page.PageError](/api/class-page.mdx#page-event-page-error) for more details.
Returns up to (currently) 200 last page errors from this page. See [Page.PageError](/api/class-page.mdx#page-event-page-error) for more details.

**Usage**

Expand Down Expand Up @@ -1575,7 +1575,11 @@ await Page.RequestGCAsync();

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

Returns up to 100 last network request from this page. See [Page.Request](/api/class-page.mdx#page-event-request) for more details.
Returns up to (currently) 100 last network request from this page. See [Page.Request](/api/class-page.mdx#page-event-request) for more details.

Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible.

Note that requests reported through the [Page.Request](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [Page.RequestsAsync()](/api/class-page.mdx#page-requests) and the amount of available information reported through [Page.Request](/api/class-page.mdx#page-event-request).

**Usage**

Expand Down
22 changes: 0 additions & 22 deletions dotnet/docs/api/class-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,6 @@ Worker.Close += async (_, worker) => {};
**Event data**
- [Worker]

---

### event Console {#worker-event-console}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.56</font><x-search>worker.event Console</x-search>

:::note

Console events from Web Workers are dispatched on the page object. Note that console events are only supported on Chromium-based browsers and within Service Workers.
:::

Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.

**Usage**

```csharp
Worker.Console += async (_, consoleMessage) => {};
```

**Event data**
- [ConsoleMessage]


[Accessibility]: /api/class-accessibility.mdx "Accessibility"
[APIRequest]: /api/class-apirequest.mdx "APIRequest"
Expand Down
2 changes: 1 addition & 1 deletion dotnet/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cd PlaywrightTests
<TabItem value="xunit-v3">

```bash
dotnet new xunit -n PlaywrightTests
dotnet new xunit3 -n PlaywrightTests
cd PlaywrightTests
```

Expand Down
6 changes: 4 additions & 2 deletions dotnet/docs/other-locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ The `:is()` pseudo-class is an [experimental CSS pseudo-class](https://developer

### CSS: matching elements based on layout

:::note
:::warning

Layout selectors are deprecated and may be removed in the future. Matching based on layout may produce unexpected results. For example, a different element could be matched when layout changes by one pixel.

Matching based on layout may produce unexpected results. For example, a different element could be matched when layout changes by one pixel.
We recommend prioritizing [user-visible locators](./locators.mdx#quick-guide) instead.
:::

Sometimes, it is hard to come up with a good selector to the target element when it lacks distinctive features. In this case, using Playwright layout CSS pseudo-classes could help. These can be combined with regular CSS to pinpoint one of the multiple choices.
Expand Down
2 changes: 1 addition & 1 deletion dotnet/docs/test-runners.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ xUnit v3 uses the [`conservative` parallelism algorithm](https://xunit.net/docs/

<TabItem value="nunit">

To customize context options, you can override the `ContextOptions` method of your test class derived from `Microsoft.Playwright.MSTest.PageTest` or `Microsoft.Playwright.MSTest.ContextTest`. See the following example:
To customize context options, you can override the `ContextOptions` method of your test class derived from `Microsoft.Playwright.NUnit.PageTest` or `Microsoft.Playwright.NUnit.ContextTest`. See the following example:

```csharp
using Microsoft.Playwright.NUnit;
Expand Down
100 changes: 50 additions & 50 deletions java/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,6 @@ The order of evaluation of multiple scripts installed via [BrowserContext.addIni

---

### backgroundPages {#browser-context-background-pages}

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

:::note

Background pages are only supported on Chromium-based browsers.
:::

All existing background pages in the context.

**Usage**

```java
BrowserContext.backgroundPages();
```

**Returns**
- [List]&lt;[Page]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-background-pages-return"/><a href="#browser-context-background-pages-return" class="list-anchor">#</a>

---

### browser {#browser-context-browser}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browserContext.browser</x-search>
Expand Down Expand Up @@ -1028,34 +1006,6 @@ BrowserContext.tracing()

## Events

### onBackgroundPage(handler) {#browser-context-event-background-page}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browserContext.onBackgroundPage(handler)</x-search>

:::note

Only works with Chromium browser's persistent context.
:::

Emitted when new background page is created in the context.

```java
context.onBackgroundPage(backgroundPage -> {
System.out.println(backgroundPage.url());
});
```

**Usage**

```java
BrowserContext.onBackgroundPage(handler)
```

**Event data**
- [Page]

---

### onClose(handler) {#browser-context-event-close}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browserContext.onClose(handler)</x-search>
Expand Down Expand Up @@ -1242,6 +1192,56 @@ BrowserContext.onWebError(handler)
**Event data**
- [WebError]

---

## Deprecated

### onBackgroundPage(handler) {#browser-context-event-background-page}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browserContext.onBackgroundPage(handler)</x-search>

:::warning Deprecated

Background pages have been removed from Chromium together with Manifest V2 extensions.

:::


This event is not emitted.

**Usage**

```java
BrowserContext.onBackgroundPage(handler)
```

**Event data**
- [Page]

---

### backgroundPages {#browser-context-background-pages}

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

:::warning Deprecated

Background pages have been removed from Chromium together with Manifest V2 extensions.

:::


Returns an empty list.

**Usage**

```java
BrowserContext.backgroundPages();
```

**Returns**
- [List]&lt;[Page]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-background-pages-return"/><a href="#browser-context-background-pages-return" class="list-anchor">#</a>


[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
Expand Down
10 changes: 7 additions & 3 deletions java/docs/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Page.close(options);

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

Returns up to 200 last console messages from this page. See [Page.onConsoleMessage(handler)](/api/class-page.mdx#page-event-console) for more details.
Returns up to (currently) 200 last console messages from this page. See [Page.onConsoleMessage(handler)](/api/class-page.mdx#page-event-console) for more details.

**Usage**

Expand Down Expand Up @@ -1388,7 +1388,7 @@ Page.opener();

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

Returns up to 200 last page errors from this page. See [Page.onPageError(handler)](/api/class-page.mdx#page-event-page-error) for more details.
Returns up to (currently) 200 last page errors from this page. See [Page.onPageError(handler)](/api/class-page.mdx#page-event-page-error) for more details.

**Usage**

Expand Down Expand Up @@ -1632,7 +1632,11 @@ Page.requestGC();

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

Returns up to 100 last network request from this page. See [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) for more details.
Returns up to (currently) 100 last network request from this page. See [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) for more details.

Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible.

Note that requests reported through the [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [Page.requests()](/api/class-page.mdx#page-requests) and the amount of available information reported through [Page.onRequest(handler)](/api/class-page.mdx#page-event-request).

**Usage**

Expand Down
22 changes: 0 additions & 22 deletions java/docs/api/class-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,6 @@ Worker.onClose(handler)
**Event data**
- [Worker]

---

### onConsole(handler) {#worker-event-console}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.56</font><x-search>worker.onConsole(handler)</x-search>

:::note

Console events from Web Workers are dispatched on the page object. Note that console events are only supported on Chromium-based browsers and within Service Workers.
:::

Emitted when JavaScript within the worker calls one of console API methods, e.g. `console.log` or `console.dir`.

**Usage**

```java
Worker.onConsole(handler)
```

**Event data**
- [ConsoleMessage]


[APIRequest]: /api/class-apirequest.mdx "APIRequest"
[APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext"
Expand Down
Loading
Loading