将列表循环到字典中,以便访问appium中的元素

2024-09-30 00:31:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个代码:基本上,我试着在这个小键盘字典中循环,根据传入的变量,点击相应的键来输入密码。在

| Create a new Passcode
| | [Documentation] | test
| | @{Passcode} = | Create List | 1 | 2 | 3 | 4
| | Enter the passcode | ${Passcode}


| Enter the passcode
| | [arguments] |  @{Keys}
| | ${keypadDictionary} | Create Dictionary
| | ... | 0         | keypad-zero
| | ... | 1         | keypad-one
| | ... | 2         | keypad-two
| | ... | 3         | keypad-three
| | ... | 4         | keypad-four
| | ... | 5         | keypad-five
| | ... | 6         | keypad-six
| | ... | 7         | keypad-seven
| | ... | 8         | keypad-eight
| | ... | 9         | keypad-nine
| | wait for screen to contain element | ${Passcode screen}
| | :FOR | ${Key} | IN | @{Keys}
| | | Tap | ${keypadDictionary['${Key}']}

我得到了这个错误:

^{pr2}$

我不知道为什么。在


Tags: thekey代码密码new字典createkeys

热门问题