如何单击按钮直到没有这样的元素?

how to click button till there is no such element?

我有一个一个删除文件的测试用例,我希望它点击每个文件直到没有文件。

但实际执行只删了一个文件就停止了

我需要实现for循环吗?

请告知如何在机器人中做到这一点。

Delete All Files
    Wait Until Page Contains And Click              ${SETTINGS-FILES}
    ${FILES}   Run Keyword And Return Status    Wait Until Page Contains Element    ${ANDROID-WIDGET-LISTVIEW}\[@resource-id="FilesList"]  2s
    Run Keyword If    ${FILES}      Wait Until Page Contains And Click              ${DELETE-FILES}
    Run Keyword If    ${FILES}      Wait Until Page Contains And Click              ${OK}
    Run Keyword If    ${FILES}      Wait Until Page Does Not Contain Element        ${ANDROID-WIDGET-LISTVIEW}\[@resource-id="$FilesList"]
    Run Keyword If    ${FILES}      Wait Until Page Contains                        No Files

一个非常粗略的解决方案

FOR    ${i}    IN RANGE    999999
    YOUR TEST
    Exit For Loop If    CONDITION TO EXIT
END