0
votes

Below is HTML code of the dropdown

<div class="comboBox" id="ATFType-main" nativeid="ATFType" iseditabletablecombo="false" style="left: 165px; top: 105px; width: 156px;">
    <a tabindex="75" data-tab="75" style="outline: medium none;" id="ATFType-box" class="comboBox_box" href="#">
        <span class="comboBox_inputs  comboBox-mandatory-input " id="ATFType-input" title="" aria-required="true" style="width: 140px;"></span>
        <span class="comboBox_buttons  comboBox-mandatory-btn " aria-haspopup="true" aria-owns="ATFType-lists" id="ATFType-button" tabindex="-1"></span>
    </a>
    <div class="comboBox_divs comboBox_corner-all" id="ATFType-div" style="height: 36.4px; width: 158px; overflow: hidden; display: none;">
        <ul class="comboBox_list  comboBox-mandatory " aria-hidden="true" aria-labelledby="ATFType-button" role="listbox" id="ATFType-lists" stylecomputed="true">
        <li data-value="" data-index="0" class="comboBox_lielements comboBox_active"></li>
        <li data-value="ATFR" data-index="1" class="comboBox_lielements">Account Transfer</li> 
        </ul>
    </div>
</div>

By clicking the span dropdown will display. Dropdown values are inside li

How to select the options mentioned in the li. we have only span ID.

1
can u add the <li> tag which gets enabled when u click on span - Ravi
Can this page be accessed outside, if yes please share the link - Ravi
Site cannot be accessable outside. Posted the solution below - Pavithran

1 Answers

0
votes

Resolved this by using the following.

code snippet:

{
webElementName.click();
String xpath="//*[@id='"+webElementId+"']//following::li[contains(text(),'"+FieldValue+"')]";
driver.findElement(By.xpath(xpath)).click();
}