Browser Clickpath Monitors support DOM and CSS locators out of the box. This covers most scenarios but for some applications an XPath locator is needed. This article will explain how to add an event to click on one.
Issue | Solution | Tasks | Alternative(s) |
---|---|---|---|
XPath locator is required for action | Use a JavaScript event | Add Javascript event and snippet. Update locator | Open a chat or support ticket |
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
a1 = getElementByXpath('xpath');
a1.click();
I know that the post is very old but Could you tell me how to implement a condition if the by chance the object (dropdown) has not been load on the page to throw an exception, please?
Could you add a javascript event and check if the resource loaded as expected?
performance.getEntriesByName("https://domain.com/fonts/bernina/BerninaSans-Web-Light.woff")[0].responseStatus
response would be 0 if it hasn't loaded.
Thanks a lot!
You not only solved my question but also gave me ideas for other questions.