如何使用Robot框架从xml库中使用Parse xml



我试图使用关键字"Set Element Attribute"从库"XML"在机器人框架。根据用户指南Set Element Attribute,这个命令的结构应该是这样的:

Set Element Attribute   source   name   value    xpath 

我想知道如何指定"来源"。我查看文档,似乎我必须使用Parse XML关键字,但我不知道如何做到这一点,以便它指的网页,就像我有当我想修改元素属性。

对于常规的RF关键字,我通常指定元素的ID并查找它,而不指定源。

Set Element Attribute为例:

Set Element Attribute     ${XML}  attr    value   
Element Attribute Should Be   ${XML}  attr    value

上面有一个链接示例,上面写着:

在这个例子中,以及在这个中的许多其他例子中文档中,${XML}指的是下面的示例XML文档。在实践中,${XML}可以是一个路径到XML文件,或者它可以包含XML本身。

例如:

Set Element Attribute   ./folder/my.xml     attr    value

或:

${XML}=    Set Variable    <example><first id="1">text</first><example>
Set Element Attribute   ${XML}  first    value

最新更新