Reputation: 52
I have a drop down list which consists of 'n' number of items. I have to verify that all the drop down items are clickable. To execute this I have used for loop as shown below:
*** Settings ***
Resource ../resources/settings.robot
*** Test Cases ***
TC title
Make sure that the user should be able to select an item from the drop down list
*** Keywords ***
Make sure that the user should be able to select an item from the drop down list
Click Element ${combo_box} //Clicking on the combo box displays the drop down list
@{get_role_list}= Get WebElements css=td.row-highted > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
:FOR ${each} IN @{get_role_list}
\ Click Element @{get_role_list} //selects an item from the list in an iteration
\ Click Element ${combo_box} //once an item from the list is selected the drop down list disappears, to iterate this loop drop down list should be displayed hence clicking on combo box after selecting an item
Any help would be appreciated.
Upvotes: 0
Views: 261
Reputation: 6971
It seems to me that you should click on ${each}
instead of @{get_role_list}
:FOR ${each} IN @{get_role_list}
\
\ # selects an item from the list in an iteration
\ Click Element ${each}
\
\ # once an item from the list is selected the drop down list disappears,
\ # to iterate this loop drop down list should be displayed hence clicking
\ # on combo box after selecting an item
\ Click Element ${combo_box}
Upvotes: 1