我可以从列表中选择一个随机值,但无法在搜索框中输入该值。问题是输入文本需要两个参数,即定位符和值。我现在停留在有价值的部分
*** Variables ***
@{cin} U74999KA2016PTC096782 U22012CH1993PTC012939 U65999MH2016PTC287488
*** Test Cases ***
Search
input text ${SEARCH_BAR}
${value} Evaluate random.choice($cin) random
log to console \nvalue: ${value}
click element ${SEARCH_BUTTON}
答案 0 :(得分:1)
您尝试在框中输入空白文本后尝试生成随机值
将代码更改为
*** Variables ***
@{cin} U74999KA2016PTC096782 U22012CH1993PTC012939 U65999MH2016PTC287488
*** Test Cases ***
Search
${value} = Evaluate random.choice($cin) random
input text ${SEARCH_BAR} ${value}
log to console \nvalue: ${value}
click element ${SEARCH_BUTTON}