Find and click a link?

Yes – the click [ Chrome | Safari ] link (by label) actions are excellent and a lot simpler – using an XPath just has a little more reach and power for the edge cases.

The kind of thing that comes to mind is:

  • multiple links with the same legend – several links labelled 'Download' on one page for example
  • links with a graphic but no text
  • links with mutable or unpredicable text etc

( When the label is an elusive anchor you can often still reach for an XPath and specify a link by some aspect of its relative or absolute position in the page structure)

There's an example here of clicking something by its HTML element id rather than by its <a> text:

2 Likes