I'm trying to set up a macro for Chrome and specifically for Gmail that uses Xpath to click on a button in certain e-mails I receive. The one issue I'm noticing is that the XPath varies in one specific way between e-mails. For example, here are XPaths from two such e-mails...
As you can see, the XPaths are identical except for the number at the beginning, which I'm guessing is some kind of e-mail ID.
With this in mind, is there any way to ignore this number and instead match by everything else in the XPath? If so, how would the macro and code here need to be updated...?
Interesting. I'm not familiar with CSSselector. Is it basically the same concept and approach as the macro shared above? Is there a comparable CSSselector-based macro that I could use?
Thanks, @noisneil! So I installed the CSSselector extension and gave this a shot. The Rel cccSelector value I'm getting for the element in question is...
span[shub-ins='1']
I tried entering this value into the placeholder you indicated, but it doesn't seem to work. The macro triggers and does nothing. Any idea what I might be doing wrong?
Here's a screenshot of the macro. I've gotten it to work in some other places, e.g. with other buttons in e-mails. But I've also encountered other situations where it's not working. I'm guessing the issue is with the cssSelector being pulled in, which I might be doing wrong.
Edit: In case it's helpful, the button is a call-to-action button in an e-mail notification from Facebook.
With this macro, do you know how to update the script so that the "OK" or error message doesn't show when it runs? I see where it happens in the script, I'm just not sure what exactly to remove. Thanks!
Oh, I went back to using the original macro above, because I thought you said to use the XPath and not the CSSselector. Were you suggesting something else?
Ah, got it. Works! Is there a way to adjust this so that instead of opening the link in a new tab and taking you to that tab, the macro instead opens the link in a new tab but keeps you on your current tab?
Perfect. Thanks, @noisneil. One other question. Is there a way to instead right click the link or element indicated by the XPath? How about middle click?
It would be cool, using XPath, to still have the flexibility that "click at found image" gives you, where you're able to do any of left/center/right single/double click, and more. (As opposed to only being limited to left single click.)