1
votes

I am using Selenium IDE and I have a dynamic drop down menu that I need to select a specific value from. The test works fine until it gets to the part where it must select the item. My commands so far include:

    type     | id=finditem | se
    typeKeys | id=finditem | se
    

And at this point I have a drop down menu with nothing selected. I used FireFinder to find that the drop down item that I have to select has this:

<<"a class="ui-corner-all" tabindex="-1">>

I also used Firebug to inspect the element and found this CSS path:

html body ul.ui-autocomplete li.ui-menu-item a.ui-corner-all

If anyone has any suggestions that would be great. Thanks.

4
what is your question? do you want to select a item from dropdown using Selenium IDE?? - Ranadheer Reddy

4 Answers

2
votes

Use following Command

command select               
Target css=yourdropdowncss   //Css or xpath of that dropdown
Value label=firstitem        //option from dropdown you want to select

Try it..

0
votes

I used the below code to select an dynamic value in drop down box and it makes the miracle.

   <tr>
    <td>click</td>
    <td>name=cmb_text_xxx</td>
    <td></td>
</tr>
    <tr>
        <td>mouseOver</td>
        <td>css=a:contains(&quot;xxx&quot;)</td>
        <td></td>
    </tr>
    <tr>
        <td>mouseDown</td>
        <td>css=a:contains(&quot;xxx&quot;)</td>
        <td></td>
    </tr>
0
votes

Since none of the mentioned solutions worked (I had a text-field that would work only if the drop-down is generated by inputting a real address, then clicked) this was my solution:

<tr>
    <td>type</td>
    <td>id=address</td>
    <td>1 Eglinton Avenue East, Toronto, ON M4P 1P1, Canada</td>
</tr>
<tr>
    <td>keyDown</td>
    <td>id=address</td>
    <td>\40</td>
</tr>
<tr>
    <td>keyDown</td>
    <td>id=address</td>
    <td>\40</td>
</tr>
<tr>
    <td>click</td>
    <td>id=ui-active-menuitem</td>
    <td></td>
</tr>

Edit: You may also need to assert/wait for the dropped-down menu (id=ui-active-menuitem) is present first. However, it will fail if the speed is set to "fast", so try it at a medium.

0
votes

(select target by clicking on main drop down:)

mouseover target= xpath:idRelative value= blank 

(select target by clicking on the specific drop down:)

mouseover target= xpath:idRelative value= blank 

(then:)

clickAndWait target=[same as above specific xpath] value=blank