Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: fix release notes snippets (#22778)

Max Schmitt6968b61fdcd0
diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md
index 168e504fff..48ec5ff219 100644
--- a/docs/src/release-notes-csharp.md
+++ b/docs/src/release-notes-csharp.md
@@ -13,21 +13,21 @@ toc_max_heading_level: 2
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```csharp
- var newEmail = page.GetByRole(AriaRole.Button, new() { Name = "New" });
- var dialog = page.GetByText("Confirm security settings");
+ var newEmail = Page.GetByRole(AriaRole.Button, new() { Name = "New email" });
+ var dialog = Page.GetByText("Confirm security settings");
await Expect(newEmail.Or(dialog)).ToBeVisibleAsync();
if (await dialog.IsVisibleAsync())
- await page.GetByRole(AriaRole.Button, new () { Name = "Dismiss" }).ClickAsync();
+ await Page.GetByRole(AriaRole.Button, new() { Name = "Dismiss" }).ClickAsync();
await newEmail.ClickAsync();
```
* Use new options [`option: hasNot`] and [`option: hasNotText`] in [`method: Locator.filter`]
to find elements that **do not match** certain conditions.
```csharp
- var rowLocator = page.Locator("tr");
+ var rowLocator = Page.Locator("tr");
await rowLocator
- .Filter(new () { HasNotText = "text in column 1" })
- .Filter(new () { HasNot = page.GetByRole(AriaRole.Button, new () { Name = "column 2 button" }))
+ .Filter(new() { HasNotText = "text in column 1" })
+ .Filter(new() { HasNot = Page.GetByRole(AriaRole.Button, new() { Name = "column 2 button" })})
.ScreenshotAsync();
```
* Use new web-first assertion [`method: LocatorAssertions.toBeAttached`] to ensure that the element
diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md
index 16a2b8debf..6879efdf01 100644
--- a/docs/src/release-notes-java.md
+++ b/docs/src/release-notes-java.md
@@ -9,11 +9,11 @@ toc_max_heading_level: 2
### Locators Update
* Use [`method: Locator.or`] to create a locator that matches either of the two locators.
- Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
+ Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```java
- Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New"));
+ Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New email"));
Locator dialog = page.getByText("Confirm security settings");
assertThat(newEmail.or(dialog)).isVisible();
if (dialog.isVisible())
diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md
index 2a811abcc9..010a736ee7 100644
--- a/docs/src/release-notes-js.md
+++ b/docs/src/release-notes-js.md
@@ -11,11 +11,11 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
### Locators Update
* Use [`method: Locator.or`] to create a locator that matches either of the two locators.
- Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
+ Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```js
- const newEmail = page.getByRole('button', { name: 'New' });
+ const newEmail = page.getByRole('button', { name: 'New email' });
const dialog = page.getByText('Confirm security settings');
await expect(newEmail.or(dialog)).toBeVisible();
if (await dialog.isVisible())
diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.md
index f8690a245d..5755816e25 100644
--- a/docs/src/release-notes-python.md
+++ b/docs/src/release-notes-python.md
@@ -9,26 +9,26 @@ toc_max_heading_level: 2
### Locators Update
* Use [`method: Locator.or`] to create a locator that matches either of the two locators.
- Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
+ Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead.
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```python
- const newEmail = page.get_by_role('button', name='New );
- const dialog = page.get_by_text('Confirm security settings');
- expect(newEmail.or_(dialog)).is_visible();
+ new_email = page.get_by_role("button", name="New email")
+ dialog = page.get_by_text("Confirm security settings")
+ expect(new_email.or_(dialog)).is_visible()
if (dialog.is_visible())
- page.get_by_role('button', name='Dismiss').click();
- newEmail.click();
+ page.get_by_role("button", name="Dismiss").click()
+ new_email.click()
```
* Use new options [`option: hasNot`] and [`option: hasNotText`] in [`method: Locator.filter`]
to find elements that **do not match** certain conditions.
```python
- const rowLocator = page.locator('tr');
- rowLocator
- .filter(has_not_text='text in column 1')
- .filter(has_not=page.get_by_role('button', name='column 2 button'))
- .screenshot();
+ row_locator = page.locator("tr")
+ row_locator
+ .filter(has_not_text="text in column 1")
+ .filter(has_not=page.get_by_role("button", name="column 2 button"))
+ .screenshot()
```
* Use new web-first assertion [`method: LocatorAssertions.toBeAttached`] to ensure that the element
is present in the page's DOM. Do not confuse with the [`method: LocatorAssertions.toBeVisible`] that ensures that