chery-pick(#19507): docs: fix HTML snippets (#19508)

This PR cherry-picks the following commits:

- ba8a6c4b08
This commit is contained in:
Playwright Service 2022-12-16 09:19:35 -08:00 committed by GitHub
parent 1263bc3edd
commit 8a9692e2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -815,7 +815,7 @@ Consider the following DOM structure where we want to click on the buy button of
<h3>Product 2</h3> <h3>Product 2</h3>
<button>Add to cart</button> <button>Add to cart</button>
</li> </li>
<ul> </ul>
``` ```
### Filter by text ### Filter by text
@ -854,7 +854,7 @@ page.get_by_role("listitem").filter(has_text="Product 2").get_by_role(
await page await page
.GetByRole(AriaRole.Listitem) .GetByRole(AriaRole.Listitem)
.Filter(new() { HasText = "Product 2" }) .Filter(new() { HasText = "Product 2" })
.GetByRole(AriaRole.Button, new () { Name = "Add to cart" }) .GetByRole(AriaRole.Button, new() { Name = "Add to cart" })
.ClickAsync(); .ClickAsync();
``` ```
@ -893,7 +893,7 @@ page.get_by_role("listitem").filter(has_text=re.compile("Product 2")).get_by_rol
await page await page
.GetByRole(AriaRole.Listitem) .GetByRole(AriaRole.Listitem)
.Filter(new() { HasTextRegex = new Regex("Product 2") }) .Filter(new() { HasTextRegex = new Regex("Product 2") })
.GetByRole(AriaRole.Button, new () { Name = "Add to cart" }) .GetByRole(AriaRole.Button, new() { Name = "Add to cart" })
.ClickAsync(); .ClickAsync();
``` ```
@ -948,11 +948,11 @@ page.get_by_role("listitem").filter(
await page await page
.GetByRole(AriaRole.Listitem) .GetByRole(AriaRole.Listitem)
.Filter(new() { .Filter(new() {
Has = page.GetByRole(AriaRole.Heading, new () { Has = page.GetByRole(AriaRole.Heading, new() {
Name = "Product 2" Name = "Product 2"
}) })
}) })
.GetByRole(AriaRole.Button, new () { Name = "Add to cart" }) .GetByRole(AriaRole.Button, new() { Name = "Add to cart" })
.ClickAsync(); .ClickAsync();
``` ```
@ -992,7 +992,7 @@ expect(
await Expect(page await Expect(page
.GetByRole(AriaRole.Listitem) .GetByRole(AriaRole.Listitem)
.Filter(new() { .Filter(new() {
Has = page.GetByRole(AriaRole.Heading, new () { Name = "Product 2" }) Has = page.GetByRole(AriaRole.Heading, new() { Name = "Product 2" })
}) })
.toHaveCountAsync(1); .toHaveCountAsync(1);
``` ```