java - Click on the dynamic element on table which is in the same row that element with known value -


i have such table

<table class="transaction"> <thead class="transaction"> <tr> <th class="seqtitle" onclick="expandorcollapse('seq2');"> <a name="seq2"> [seq: 2]</a>   //dynamic id link </th> <th class="transtitle">  "some known text + other dynamic id"   <span class="toolbar">   .... 

and challenge me click on link dynamic id (in case seq2) when know in same row there element partially known value ("some known text + other dynamic id")
tried xpath following-sibling , preceding-sibling without success cuz dont know how reach dynamically generated link id
ideas?

using preceding-sibling axis could've worked, example :

//table/thead/tr/th[starts-with(., 'some known text')]/preceding-sibling::th[1]/a 

brief explanation :

  • th[starts-with(., 'some known text')] : find th element having text content starts "some known text"
  • /preceding-sibling::th[1] : such th elements, find nearest preceding sibling th element
  • /a : each of preceding siblings th mentioned before, return child element a

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -