Selenium XPath of preceeding element -


i have scenario wherein html tags generated dynamically through ajax shown below

<div>    <span class="rptname">qlms</span>    <span id="button_id_91">//generated dynamically      <span id="button_span_right_91">            <span id="button_91"/>      </span>    </span>    <span class="rptname">qlrs</span>    <span id="button_id_92">//generated dynamically      <span id="button_span_right_92">            <span id="button_92"/>      </span>    </span> </div> 

the span elements generated dynamically, in such scenarios how xpath based on text search(qlms,qlrs present in span). need click event on

<span id="button_92" or "91"/>

please let me know how achieve in such scenario.

thanks in advance

seems pretty tricky. using following-sibling should help. filtering out span partial id right. try this:

//span[contains(text(),'qlrs')]/following-sibling::span//span[not(contains(@id,'right'))] 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -