Я пытаюсь перечислить все элементы из выпадающего списка bootstrap, а затем выбрать определенное значение. Тем не менее, он возвращает 0 значений. Любые предложения будут с благодарностью.
driver.findElement(By.id("imgSelectButton")).click();
Thread.sleep(3000);
List<WebElement> list = driver.findElements(By.xpath("//ul/li[@class='logoSelectOpt']//li"));
System.out.println(list.size());
for(int i=0; i<list.size(); i++){
System.out.println(list.get(i).getText());
if (list.get(i).getText().contains("History")){
list.get(i).click();
break;
}
}
ДОМ:
<div class="logoSelect" style="z-index:1; top:878px;">==$0
<ul>
<li class="logoSelectOpt" id="12" onmouseover="jQuery(QWE01Title.activate(this);" onmouseout="jQuery(QWE01Title.deactivate(this);" onmousedown="jQuery(QWE01Title.selectItem(this);" logoColor="#FFF">Facts</li>==0
<li class="logoSelectOpt" id="12" onmouseover="jQuery(QWE01Title.activate(this);" onmouseout="jQuery(QWE01Title.deactivate(this);" onmousedown="jQuery(QWE01Title.selectItem(this);" logoColor="#FFF">History</li>==0
<li class="logoSelectOpt" id="12" onmouseover="jQuery(QWE01Title.activate(this);" onmouseout="jQuery(QWE01Title.deactivate(this);" onmousedown="jQuery(QWE01Title.selectItem(this);" logoColor="#FFF">Opinions</li>==0
<li class="logoSelectOpt" id="12" onmouseover="jQuery(QWE01Title.activate(this);" onmouseout="jQuery(QWE01Title.deactivate(this);" onmousedown="jQuery(QWE01Title.selectItem(this);" logoColor="#FFF">Questions</li>==0
</ul>
</div>