如何在机器人框架中使用按键验证下拉框

时间:2018-11-22 05:34:14

标签: robotframework

我需要使用键盘操作来验证下拉框。我写了脚本,但是抛出错误

    *** Variables ***

    ${dropdown_button}          css=.list > div:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > mat-icon:nth-child(1) > svg:nth-child(1)
    ${dropdown_list_1}             css=.list > div:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1)
    ${dropdown_list_2}             css=.list > div:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2)
    ${dropdown_list_3}             css=.list > div:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3)

   *** Keywords ***

    Click Element "${dropdown_button}"
    Sleep  3s
    Press Key  ${dropdown_list_1}  \ue015    #Down arrow
    Press Key  ${dropdown_list_2}  \ue015    #Down arrow
    Press Key  ${dropdown_list_3}  \ue013    #up arrow
    Press Key  ${dropdown_list_2}  \ue007    #Pressing enter

0 个答案:

没有答案