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
21 changes: 21 additions & 0 deletions dotnet/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,27 @@ await button.ClickAsync();

---

### Description {#locator-description}

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

Returns locator description previously set with [Locator.Describe()](/api/class-locator.mdx#locator-describe).

**Usage**

```csharp
var button = Page.GetByRole(AriaRole.Button).Describe("Subscribe button");
Console.WriteLine(button.Description()); // "Subscribe button"

var input = Page.GetByRole(AriaRole.Textbox);
Console.WriteLine(input.Description()); // null
```

**Returns**
- [string]?<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-description-return"/><a href="#locator-description-return" class="list-anchor">#</a>

---

### DispatchEventAsync {#locator-dispatch-event}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.14</font><x-search>locator.DispatchEventAsync</x-search>
Expand Down
7 changes: 4 additions & 3 deletions dotnet/docs/network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ page.WebSocket += (_, ws) =>
## Missing Network Events and Service Workers

Playwright's built-in [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route) allow your tests to natively route requests and perform mocking and interception.
1. If you're using Playwright's native [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [ServiceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.
1. It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).
1. If you're interested in not solely using Service Workers for testing and network mocking, but in routing and listening for requests made by Service Workers themselves, please see [this experimental feature](https://github.com/microsoft/playwright/issues/15684).

If you're using Playwright's native [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [ServiceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.

It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route) and [Page.RouteAsync()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).


[Accessibility]: /api/class-accessibility.mdx "Accessibility"
Expand Down
21 changes: 21 additions & 0 deletions java/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,27 @@ button.click();

---

### description {#locator-description}

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

Returns locator description previously set with [Locator.describe()](/api/class-locator.mdx#locator-describe).

**Usage**

```java
Locator button = page.getByRole(AriaRole.BUTTON).describe("Subscribe button");
System.out.println(button.description()); // "Subscribe button"

Locator input = page.getByRole(AriaRole.TEXTBOX);
System.out.println(input.description()); // null
```

**Returns**
- [null] | [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-description-return"/><a href="#locator-description-return" class="list-anchor">#</a>

---

### dispatchEvent {#locator-dispatch-event}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.14</font><x-search>locator.dispatchEvent</x-search>
Expand Down
7 changes: 4 additions & 3 deletions java/docs/network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,10 @@ page.onWebSocket(ws -> {
## Missing Network Events and Service Workers

Playwright's built-in [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route) allow your tests to natively route requests and perform mocking and interception.
1. If you're using Playwright's native [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [setServiceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.
1. It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).
1. If you're interested in not solely using Service Workers for testing and network mocking, but in routing and listening for requests made by Service Workers themselves, please see [this experimental feature](https://github.com/microsoft/playwright/issues/15684).

If you're using Playwright's native [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [setServiceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.

It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [Page.route()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).


[APIRequest]: /api/class-apirequest.mdx "APIRequest"
Expand Down
21 changes: 21 additions & 0 deletions nodejs/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,27 @@ await button.click();

---

### description {#locator-description}

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

Returns locator description previously set with [locator.describe()](/api/class-locator.mdx#locator-describe).

**Usage**

```js
const button = page.getByRole('button').describe('Subscribe button');
console.log(button.description()); // "Subscribe button"

const input = page.getByRole('textbox');
console.log(input.description()); // null
```

**Returns**
- [null] | [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-description-return"/><a href="#locator-description-return" class="list-anchor">#</a>

---

### dispatchEvent {#locator-dispatch-event}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.14</font><x-search>locator.dispatchEvent</x-search>
Expand Down
10 changes: 7 additions & 3 deletions nodejs/docs/network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,13 @@ page.on('websocket', ws => {
## Missing Network Events and Service Workers

Playwright's built-in [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route) allow your tests to natively route requests and perform mocking and interception.
1. If you're using Playwright's native [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [serviceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.
1. It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).
1. If you're interested in not solely using Service Workers for testing and network mocking, but in routing and listening for requests made by Service Workers themselves, please see [this experimental feature](https://github.com/microsoft/playwright/issues/15684).

If you're using Playwright's native [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route), and it appears network events are missing, disable Service Workers by setting [serviceWorkers](/api/class-browser.mdx#browser-new-context-option-service-workers) to `'block'`.

It might be that you are using a mock tool such as Mock Service Worker (MSW). While this tool works out of the box for mocking responses, it adds its own Service Worker that takes over the network requests, hence making them invisible to [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route). If you are interested in both network testing and mocking, consider using built-in [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route) and [page.route()](/api/class-page.mdx#page-route) for [response mocking](#handle-requests).

######
If you're interested in not solely using Service Workers for testing and network mocking, but in routing and listening for requests made by Service Workers themselves, please see [this guide](./service-workers.mdx).


[Accessibility]: /api/class-accessibility.mdx "Accessibility"
Expand Down
Loading
Loading