1

I have this not so neat HTML piece:

<a href="#" onclick="JavaScript:fnActivity('-247239453','C');return false;">
    ACCOUNT
    -
    <span class="td-copy-nowrap">4575 <span class="td-copy-nowrap">6017785<span class="td-link-icon">›</span></span></span>
</a>

And I have this meta-information: 6017785

Can I write a xpath selector that will find the link (a) element based on this number?

I tried //span[contains(text(), '6017785')]/ancestor::a but it doesn't seem to work, probably because of the span inside a span, near the number?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Bruno
  • 4,685
  • 7
  • 54
  • 105

1 Answers1

1

This XPath,

//a[contains(.,'6017785')]

will select all a elements whose string value contains the substring, 6017785.

See also:

kjhughes
  • 106,133
  • 27
  • 181
  • 240