首页 文章

机器人框架 - 字典变量

提问于
浏览
0

我'm trying to create dynamic dictionary variables. Let' s说我有 &{Day_Dropdown_Value} ,它的变量为 UK=li:nth-of-type(5)AU=div:nth-of-type(7) . 我可以通过国家参数使用这个字典变量,如 &{Day_Dropdown_Value}[${COUNTRY}] . 但实际上我想让字典的变量像 UK=li:nth-of-type(${value}) 一样动态变化 . 这种情况有什么解决方案吗?

1 回答

  • 0

    更新了Burak评论的答案 . 您需要使用“从字典获取”来获取值

    *** Settings ***
    Library    Collections
    
    *** Test Cases ***
    Dict
        ${Day_Dropdown_Value}=    Create Dictionary
        Set To Dictionary         ${Day_Dropdown_Value}    AU=7
        Set To Dictionary         ${Day_Dropdown_Value}    UK=5
        ${value}=                 Get From Dictionary    ${Day_Dropdown_Value}    UK
        Log                       li:nth-of-type(${value})
    

相关问题