Context object.
CSS selector to watch.
Optional
options: Partial<WatchSelectorOptions>Enter, leave callbacks and ensureVisible flag.
const watcher = watchSelector(ctx, '.selector', {
async enter: (el: ElementHandle) => {
// do something with matched el when appeared
},
async leave: (el: ElementHandle) => {
// do something with matched el when disappeared
},
});
// ...
watcher.stop()
Generated using TypeDoc
Watches an element by CSS selector, and executes code when it appears or disappears.