如何在 Robot Framework- SeleniumLibrary 中获取多个元素并打印?

How can I get multiple elements and print in Robot Framework- SeleniumLibrary?

${get_t}=    Get Text    //h6[@class='MuiTypography-root MuiTypography-subtitle2']
Log    ${get_t}
${get_t1}=    Get Element Count    xpath://h6[@class='MuiTypography-root MuiTypography-subtitle2']
Log    ${get_t1}
${get_t3}=    Get WebElements    xpath://h6[@class='MuiTypography-root MuiTypography-subtitle2']
Log    ${get_t3}

当我得到 Count 时它显示计数但是当我使用 Get WebElements 打印它时它不打印文本。如果我给出 Get Text 它会单独打印第一个文本。

Xpath

你想实现什么 - get/print 每个元素的文本?因为 Get Webelements 正如它的名字所说的那样 - returns 你是一个匹配元素的列表 - selenium 元素对象。 有了这个,如果你想打印每个人的文本,只需遍历列表并在每个成员上调用 Get Text

FOR    ${el}    IN    @{get_t3}
    ${txt}=    Get Text    ${el}
    Log    ${txt}
END