Note that there are some explanatory texts on larger screens.

plurals
  1. POSelenium driver - select the desired li item in the list
    primarykey
    data
    text
    <p>In a list of 8 Elements I would select the one that contains the search text in children div. I need this because the elements of the list changes order every time. Here I would like to select the one that contains the text "TITLE TO LISTEN". How do I scroll through the list and select the wish li?</p> <p>Thanks in advance</p> <p>Here one li:</p> <pre><code>... &lt;li id="3636863298979137009" class="clearfix" data-size="1" data-fixed="1" data-side="r"&gt; &lt;div class="userContentWrapper"&gt; &lt;div class="jki"&gt; &lt;span class="userContent"&gt; TITLE TO LISTEN &lt;/div&gt; &lt;div class="TimelineUFI uiContainer"&gt; &lt;form id="u_0_b0" class="able_item collapsed_s autoexpand_mode" onsubmit="return window.Event &amp;&amp; E" action="/ajax/ufi/modify.php" method="post" &gt; &lt;input type="hidden" value="1" name="data_only_response" autocomplete="off"&gt; &lt;div class="TimelineFeedbackHeader"&gt; &lt;a class="ction_link" role="button" title="Journal" data-ft="{"tn":"J","type":25}" rel="dialog" href="/ajax/" tabindex="0" rip-style-bordercolor-backup="" style="" rip-style-borderstyle-backup="" &gt;LISTEN&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; ... </code></pre> <p>I tried this code, but it don't work because the elements ids change each time.</p> <pre><code> driver.findElement(By.xpath("//li[8]/div[2]/div/div[2]/form/div/div/span[2]/a")).click(); </code></pre> <p>For example:</p> <pre><code>If text contain "TEXT TO LISTEN": li[3]/div[2]/div/div/div[2]/div/div/span Link "listen" i want to click : li[3]/div[2]/div/div[2]/form/div/div/span[2]/a </code></pre> <p>here is number 3, but the order may change. I would first like to get that number and then click on the right link</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload