Clicking A Chrome Link With A Dynamic Xpath

I'm having trouble figuring out a solution for this one step in my macro. I need to click a "Yes" confirmation button in Google Chrome, but the XPath is not consistent. I think some javascript is probably the best solution, but I'm not experienced in it.


It may require a more complicated querySelector, but let's try this first.
Put this JavaScript in a Execute a JavaScript in Front Browser action

var linkElem = document.querySelector('a.btn-primary');
linkElem.click();

If that doesn't work, it would be best if you can provide us with the page URL.

That didn't do it. It prompted this dialogue that I've not seen before

the page is behind a login, so providing the URL won't do any good, unfortunately

Still haven't found a solution :frowning: any help would be appreciated

Does a click at found image action work for you? It's quick and dirty but many great minds can't see an easy solution for you so we're probably at the dirty stage...

Hey Richard,

Just for giggles, try this:

document.querySelector('a.btn.btn-primary').click()

If that doesn’t work I recommend you follow Vincent's suggestion and use a Click at Found Image condition – at least for the time being.

-Chris

Hey Chris, I could be wrong, but I think that is effectively the same as I posted:

IMO, it is unlikely that the more generic class "btn" would help identify the target button.