Trouble with Google Chrome Xpath

This is my first time using Keyboard Maestro and unfortunately have no coding experience. Would really appreciate the help.

Currently trying to create a Script to automate crosslisting eBay items to other sites like Poshmark & Mercari. I'm able to click certain Google Chrome Links using the Xpath but I've been running into some that don't have valid Xpaths. I've also tried using a screenshot of the dropdown but had no luck with that either. I've watched multiple tutorials but haven't had any luck. I did read on the forum that I might have to use Javascript? Any help would be greatly appreciated!

Elements on a page don't "have" XPaths – the XPath syntax allows various ways of describing the position of any element (or group of related elements).

Reference to a unique id is only one of several ways of defining an XPath to an item.

If you are not familiar with XPath syntax, then in Chrome:

  • Ctrl-click on the element that interests you:
  • From the contextual menu that appears choose Inspect
  • In the web inspector view which appears, again Ctrl-click on the highlighted tag
  • Choose Copy > Copy XPath or Copy > Copy Full Xpath, and paste the result wherever you need it.

Thank you for your reply. I tried that and on some I get a line with "html" instead of something that starts with "//*[@id"

Screen Shot 2022-04-07 at 7.58.16 AM

Correct. That is what you need – an actual XPath to the selected element.

Why would you want the XPath to an element to start with that ?

That would be irrelevant in the case of an element which has no id attribute :slight_smile:

An XPath expresses a real path to an element.

(Not one which doesn't, and cannot, exist).

Perhaps there is some confusion in your mind between XPaths and id attributes ?

Not all XPaths involve reference to attributes (id or other)

See: XPath | MDN