Note that there are some explanatory texts on larger screens.

plurals
  1. POWebDriver can't select from JQuery dropdown
    text
    copied!<p>I have a web form having JQuery dropdowns. The particular field holds date of birth. The source for the field is:</p> <pre><code>&lt;div class="tooltipGroup" style="z-index:19;"&gt; &lt;div class="day"&gt; &lt;div class="jqTransformSelectWrapper" style="z-index: 19;"&gt; &lt;div&gt; &lt;ul style="width: 100%; display: block; visibility: visible;"&gt; &lt;li class="optHeading"&gt; &lt;li class="undefined"&gt; &lt;li class="undefined"&gt; &lt;li class="undefined"&gt; &lt;li class="undefined"&gt; &lt;li class="undefined"&gt; &lt;li class="undefined"&gt; &lt;a index="6" href="#"&gt;6&lt;/a&gt; &lt;/li&gt; &lt;li class="undefined"&gt; &lt;a index="31" href="#"&gt;31&lt;/a&gt; &lt;/li&gt; </code></pre> <p>That's the code trying to get all of the elements and put them in a HashMap:</p> <pre><code>public void selectDob(int dob) { WebElement dobFieldDropdown; WebElement content = driver.findElement(By.className("leftClmn")); driver.findElement(By.id("aWrapper_dob_day")).click(); dobFieldDropdown = content.findElements(By.className("tooltipGroup")).get(2).findElement(By.className("day")).findElement(By.tagName("ul")); HashMap&lt;String, WebElement&gt; dropdownValues = new HashMap&lt;String, WebElement&gt;(); for (WebElement el : dobFieldDropdown.findElements(By.tagName("a"))) { dropdownValues.put(el.getText(), el); System.out.println(el.getText()); } dropdownValues.get(dob).click(); } </code></pre> <p>The code works just fine with one exception: it can't get the values of all fields, just the first visible when the dropdown is being opened.</p> <blockquote> <p>1 2 3 4 5</p> </blockquote> <p>The question is how to get the values of the other fields?</p>
 

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