0

@Friends我是初学者,所以请指导我,如果下面的xpath是正确的,请告诉我

<ol `id ="no_0a_autocomplete_list" class="autocomplete_list" style..">  
<li class="item current_item" onselect="this.text.value ='DELHI (DLI)'; ">  
<li class="item" onselect="enter code herethis.text.value ='DELHI (DLI)'; ">  
<span>(DLI)</span>DELHI</li>

硒代码

WebElement OlElement= driver.findElement(By.xpath("//*[@id='no_0a_autocomplete_list']"));   
List<WebElement> Str= OlElement.findElements(By.tagName("/li/span[text()='(DLI)']"));   
for(WebElement testlist : Str)
{ // Perform click//}
4

1 回答 1

0
ListWebElement examples = driver.findElements(By.xpath("//*@id='no_0a_autocomplete_list']/li"));

for (WebElement option: examples) 
{ 
    if ("value".equals(option.getText())) 
    {
         option.click();
         break;
    }       
}
于 2013-10-03T16:57:26.003 回答