使用Robot Framework,我有一个带有多个选项的下拉菜单。当我使用select from list by label
时,它选择了选项,但是一旦Robot填充了文本字段,两个选择都回到默认状态。
[这是下拉列表的选择][1][1]: https://i.stack.imgur.com/laqzf.png
[这是填充文本字段后丢失的选择][2][2]: https://i.stack.imgur.com/MVk3U.png
我使用以下命令:
select from list by label xpath=(.//*[normalize-space(text()) and normalize-space(.)='Complexidade'])[1]/following::select[1] Complexo
sleep 2s
select from list by label xpath=(.//*[normalize-space(text()) and normalize-space(.)='SIEM'])[1]/following::select[1] Microsoft Azure Sentinel
sleep 2s
set focus to element xpath=//div[@id='app']/div[2]/div/div[3]/form/div[2]/div[9]/textarea
press keys xpath=//div[@id='app']/div[2]/div/div[3]/form/div[2]/div[9]/textarea R
您应该使用Input Text来在文本字段中输入文本,而不是使用Press Keys。
Input Text xpath text_to_enter
工作代码select from list by label xpath=(.//*[normalize-space(text()) and normalize-space(.)='Complexidade'])[1]/following::select[1] Complexo
sleep 2s
select from list by label xpath=(.//*[normalize-space(text()) and normalize-space(.)='SIEM'])[1]/following::select[1] Microsoft Azure Sentinel
sleep 2s
Input Text xpath=//div[@id='app']/div[2]/div/div[3]/form/div[2]/div[9]/textarea R