You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it would be nice if handlers added by addLocatorHandler could be removed
Example
remove a handler at a certain point in the test:
consthandler=awaitpage.addLocatorHandler(page.getByText('Sign up to the newsletter'),async()=>{awaitpage.getByRole('button',{name: 'No thanks'}).click();});awaitpage.goto('https://example.com');awaitpage.getByRole('button',{name: 'Start here'}).click();// at this point we can be confident that the popup has either already appeared, or won't appear at all,// so it's safe to remove the handler.handler.remove()
remove a handler after it's called once:
awaitpage.addLocatorHandler(page.getByText('Sign up to the newsletter'),async(handler)=>{awaitpage.getByRole('button',{name: 'No thanks'}).click();handler.remove()});
### Motivation-insomecases,alocatorhandlerisonlyneededonce-atacertainpointinthetest,youcanoftenbeconfidentthatahandlerisnolongerneeded
The text was updated successfully, but these errors were encountered:
- Automatically waiting for the overlay locator to be hidden, with
`allowStayingVisible` opt-out.
- `times: 1` option.
- `removeLocatorHandler(locator, handler)` method.
- Passing `locator` as first argument to `handler`.
Fixes#30471. Fixes#30424. Fixes#29779.
馃殌 Feature Request
it would be nice if handlers added by
addLocatorHandler
could be removedExample
remove a handler at a certain point in the test:
remove a handler after it's called once:
The text was updated successfully, but these errors were encountered: