html - How to identify an element via XPath when IDs keep changing -


i using website, values of elements changing dynamically every time elements load. id's dynamic , xpath. don't seem have unique identifier locate elements. please advise on best way uniquely identify element every time page loads.

here example of xpath when page loads first time:

.//*[@id='isc_hy']/table/tbody/tr/td 

the same element when run follows:

.//*[@id='isc_ip']/table/tbody/tr/td     

there several other elements on page looks above elements.

for example, there element following xpath don't need:

.//*[@id='isc_i2']/table/tbody/tr/td 

here html information same:

<div id="isc_hy" style="position: relative; display: inline-block; box-sizing: border-box; width: 100%; vertical-align: top; visibility: inherit; z-index: 204195; cursor: pointer;" eventproxy="isc_obtabbarbuttonchild_9">  <table width="68px" height="38px" cellspacing="0" cellpadding="0">  <tbody>  <tr>  <td class="obtabbarbuttonchildtitleover" valign="center" nowrap="true" align="right" onfocus="isc_obtabbarbuttonchild_9_label.$47()" tabindex="-1">item pricing</td> </tr> </tbody> </table> </div> </div> <div id="isc_i0" class="obtabbarbuttonchildtopover" onscroll="return isc_obtabbarbuttonchild_9.$lh()" style="position: absolute; left: 208px; top: 0px; width: 96px; height: 38px; z-index: 204194; box-sizing: border-box; overflow: hidden; cursor: pointer; outline-style: none;" tabindex="4914" onblur="if(window.isc)isc.eh.blurfocuscanvas(isc_obtabbarbuttonchild_9,true);" onfocus="if(event.target!=this)return;isc.eh.focusincanvas(isc_obtabbarbuttonchild_9,true);" role="tab" eventproxy="isc_obtabbarbuttonchild_9"> <div id="isc_i1" onscroll="return isc_obtabbarbuttonchild_10.$lh()" style="position: absolute; left: 319px; top: 0px; width: 59px; height: 38px; z-index: 204213; box-sizing: border-box; overflow: hidden; cursor: pointer; outline-style: none;" tabindex="-1" onblur="if(window.isc)isc.eh.blurfocuscanvas(isc_obtabbarbuttonchild_10_label,true);" onfocus="if(event.target!=this)return;isc.eh.focusincanvas(isc_obtabbarbuttonchild_10_label,true);" role="label" eventproxy="isc_obtabbarbuttonchild_10"> 

i looking click on "item pricing" text.

you can select table cell contents equals string such "item pricing" via following xpath:

//td[. = 'item pricing'] 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -