Deekshith
Deekshith

Reputation: 1

Robot Framework Element Not Visible Exception in Dropdown checkbox

I am receiving an ElementNotVisibleException though I am not sure why. When I look at the screen capture in the logs, the element is clearly visible.

Here is the HTML code

<div id="xdo:parameters" class="xdoParameters">
  <table class="fieldText parameters" summary="" cellspacing="0">
    <tbody>
        <tr>
            <td class="left">
            <div id="xdo:_paramsBrncd_div" style="width: 120px; display: inline; white-space: nowrap; font-size: 13px; zoom: 1; margin: 0px; padding: 0px; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-weight: normal; color: rgb(0, 0, 0); cursor: pointer;">
            <input type="text" id="xdo:xdo:_paramsBrncd_div_input" name="xdo:xdo:_paramsBrncd_div_input" readonly="readonly" onkeypress="var code = EventUtils.getKeyCode(event); if (code == 40 || code == 13) {document.getElementById(this.id).parentNode.onclick();} return true;" class="mchoicebox" style="width: 103px; padding: 2px 0px 1px;">
            <span style="border-style: solid; border-color: rgb(172, 186, 207) rgb(0, 0, 0) rgb(0, 0, 0) rgb(183, 183, 178); border-width: 1px; margin: 1px 1px 1px 0px; background-image: url(&quot;/xmlpserver/resource/blafplus/menu/gradient_n.png&quot;); background-position: center top; background-repeat: repeat; font-size: 12px; padding-top: 1px; padding-bottom: 1px;">
                <span tabindex="-1" style="margin-left: -2px; margin-right: -2px; background-repeat: no-repeat; background-image: url(&quot;/xmlpserver/resource/blafplus/menu/dropdown_n.png&quot;); background-position: center center; font-size: 12px; outline-width: 0px; padding-right: 14px; cursor: pointer;">
                <span style="opacity: 0; zoom: 1;">&nbsp;</span>
                </span>
            </span>
                <select name="_paramsBrncd" id="xdo:_paramsBrncd" multiple="multiple" style="display: none;">
                <option value="100">100</option>
                <option value="200">200</option>
                <option value="300">300</option>
                <option value="400">400</option>
                <option value="500">500</option>
                <option value="999">999</option>
                </select>
            </div>
            </td>
            <td class="left">...</td>
        </tr>
    </tbody>
  </table>
</div>

This is my code

        Wait Until Element is Visible         (//div[@id="xdo:parameters"]//select)[1]        5s
        Select From List By Value        (//div[@id="xdo:parameters"]//select)[1]        100
        Select From List By Value        (//div[@id="xdo:parameters"]//select)[2]        150
        Select From List By Value        (//div[@id="xdo:parameters"]//select)[2]        151
        Wait Until Element is Visible         //button[.="Apply"]
        Click Element        //button[.="Apply"]

It throws this error Element '(//div[@id="xdo:parameters"]//select)[1]' not visible after 5 seconds.

Upvotes: 0

Views: 99

Answers (1)

TheLeviathan
TheLeviathan

Reputation: 21

Why don't you want to try to pick the element right at it's ID instead of going through parent div? . Depending on your page structure some elements might load dynamically - especially in case of drop downs. So at the point of trying to get the element from the dom it might simply not be there. Try other element locators

//select[@id='xdo:_paramsBrncd']

Should work fine.

Even better just use the id locator itself

${YOUR_ELEMENT_LOCATOR}        id:xdo:_paramsBrncd

Upvotes: 1

Related Questions