reformat
This commit is contained in:
parent
98fa984e8d
commit
64da70b480
|
|
@ -13,9 +13,11 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
|
||||||
- New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears:
|
- New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears:
|
||||||
```js
|
```js
|
||||||
// Setup the handler.
|
// Setup the handler.
|
||||||
await page.addLocatorHandler(page.getByRole('heading', { name: 'Hej! You are in control of your cookies.' }), async () => {
|
await page.addLocatorHandler(
|
||||||
await page.getByRole('button', { name: 'Accept all' }).click();
|
page.getByRole('heading', { name: 'Hej! You are in control of your cookies.' }),
|
||||||
});
|
async () => {
|
||||||
|
await page.getByRole('button', { name: 'Accept all' }).click();
|
||||||
|
});
|
||||||
// Write the test as usual.
|
// Write the test as usual.
|
||||||
await page.goto('https://www.ikea.com/');
|
await page.goto('https://www.ikea.com/');
|
||||||
await page.getByRole('link', { name: 'Collection of blue and white' }).click();
|
await page.getByRole('link', { name: 'Collection of blue and white' }).click();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue