Robotframework 环形机器人框架

Robotframework 环形机器人框架,robotframework,Robotframework,我想将元素保存到一个列表中,然后运行FOR循环对它们进行迭代 我尝试了以下方法: *** Keywords *** User Claims Tasks @{tasks}= Get WebElements ${claim} FOR ${task} IN @{tasks} Click Element ${task} ${missing}= Run Keyword And Return Status

我想将元素保存到一个列表中,然后运行FOR循环对它们进行迭代

我尝试了以下方法:

*** Keywords ***
User Claims Tasks
    @{tasks}=    Get WebElements    ${claim}
    FOR    ${task}    IN    @{tasks}
        Click Element    ${task}    
        ${missing}=    Run Keyword And Return Status    Element Should Be Visible    ${miss}
        Run Keyword If    '${missing}' == 'True'    Click Element    ${miss}
        ${continue}=      Run Keyword And Return Status    Element Should Be Visible    ${cont}
        Run Keyword If    '${continue}' == 'True'    Click Element    ${cont}
    END
然而,这是行不通的。它运行一次,然后我得到错误:

20200911 13:40:19.734 : FAIL : IndexError: list index out of range
20200911 13:40:19.737 : INFO : ${relation uid} = ('FAIL', 'IndexError: list index out of range')
20200911 13:40:19.742 : INFO : Relation UID:('FAIL', 'IndexError: list index out of range')
20200911 13:40:19.744 : INFO : Client Information:, 
Ending test:

关于如何完成这项工作有什么想法吗?

对我有效的解决方案:

*** Keywords ***
User Claims Tasks
    ${tasks}=    Get Element Count    ${claim}
    FOR    ${i}    IN RANGE    ${tasks}
        ${present}=    Run Keyword And Return Status    Element Should Be Visible    ${claim}  
        Run Keyword If   '${present}' == 'True'    Click Element    ${claim}  
        ${missing}=    Run Keyword And Return Status    Element Should Be Visible    ${drm}
        Run Keyword If    '${missing}' == 'True'    Click Element    ${drm}
        ${continue}=      Run Keyword And Return Status    Element Should Be Visible    ${cont}
        Run Keyword If    '${continue}' == 'True'  Click Element    ${cont}
    END

请共享引发此错误的行,以及此行的返回值
@{tasks}=Get WebElements${claim}
,如log.html中所示。@{tasks}=[|当它想要单击第二个任务时(2次迭代开始-单击元素任务)会发生错误。它无法单击任务,因为:元素未附加到页面文档。请尝试
单击元素${task.get_属性(“id”)}
它不会使用过时的webelement,但会根据ID单击该元素。如果页面刷新或正在发生的任何事情没有更改任务的ID,它会起作用。当您单击页面中的任务时,它是否会更改?例如,重新绘制任务列表?第3条注释中的异常情况看起来是这样的。如果为真,您必须重新考虑逻辑——不是一开始就获取所有元素——因为它们会随着交互而改变,而是在仍然存在任务元素时循环,每次都重新设置它们。