3
${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 在此处输入图像描述

4

1 回答 1

5

你想实现什么 - 获取/打印每个元素的文本?因为Get Webelements正如它的名字所说的那样——返回一个匹配元素的列表——硒元素对象。有了这个,如果你想打印每个人的文本,只需遍历列表并调用Get Text每个成员:

FOR    ${el}    IN    @{get_t3}
    ${txt}=    Get Text    ${el}
    Log    ${txt}
END
于 2020-02-01T11:50:02.550 回答