【发布时间】:2020-12-09 11:11:52
【问题描述】:
这是我的代码:
<div class="table row column" xpath="1">
<div class="table__head">
<div class="table__row">
<div class="table__cell sys-log__col-wrapper sys-log__col-id">
<div class="column small-2 sort_button_wrapper">
<button class="sort-ascending" ng-click="sortBy('Id', false)"></button>
<button class="sort-descending" ng-click="sortBy('Id', true)"></button>
</div>
ID
</div>
<div class="table__cell sys-log__col-wrapper sys-log__col-desc">Description</div>
</div>
</div>
${xpath_1} = //div[@class="table__row"]/div[1]
${xpath_2} = //div[@class="table__row"]/div[2]
我需要将 ID 作为xpath_1 的输出,并将描述作为xpath_2 的输出。但是当我尝试获取以下代码的输出时,我得到了:
${table_data}= Get Table Cell ${xpath_1}
此方法出现以下错误
关键字“SeleniumLibrary.Get Table Cell”需要 3 到 4 个参数,得到 1 个。
(或)
${table_data}= Get Text ${xpath_1}
这个方法的输出是空白
请建议我如何使用机器人框架从上表中获取 ID 和描述作为输出。
【问题讨论】:
-
鉴于 html 中没有
<table> </table>,我不希望Get Table Cell工作。基于documentation,它还提供了有关它所需的其他属性的信息。你试过Get Text或Get Value直接检索它们吗? -
我已经尝试使用 Get Text,它返回空白空间,而对于 Get Value,我得到 None
-
您能否通过edit 功能将您尝试过的确切命令添加到您的问题中?这样我们就可以更好地了解正在发生的事情。
标签: robotframework robotframework-sshlibrary robotframework-swinglibrary robotframwork-whitelibrary