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