robotframework-browser 中的“Get Elements”不再返回引用

"Get Elements" in robotframework-browser doesn't return references anymore

提问人:Dima 提问时间:11/14/2023 更新时间:11/14/2023 访问量:21

问:

我在 robotframework-browser 17.5.2 版本中对 Get Element 关键字有问题。

在此之前,在我们的项目中,我们使用了 16.3.0 版本,Get Elements 关键字返回了一个列表,其中包含对元素的一些引用,例如:等。['element=e3f17177-2cd1-4018-8661-a8b0a05f75c6', 'element=64260a05-9ec9-4e6f-8293-7838fe97027b', 'element=d4054c8c-9253-4191-8f08-768ff3c37f4e', 'element=22e5554a-d022-4ce7-9aed-e65a2b3adb06']

之后,我们迭代了这个列表,得到了这个元素,据我了解,当我们从列表中得到一个元素时,这个引用会转换为xpath定位器。之后,我们将这个 xpath 定位器和另一个定位器连接起来,以获得新的唯一定位器,以便在页面上找到所需的元素。

但是现在,在新版本 17.5.2 中,Get Elements 关键字返回了一个带有定位符的列表,而不是引用。它看起来像:。Found locator('xpath=//*[@class="status-label status-label--active"]/../..').first(),locator('xpath=//*[@class="status-label status-label--active"]/../..').nth(1),locator('xpath=//*[@class="status-label status-label--active"]/../..').nth(2),locator('xpath=//*[@class="status-label status-label--active"]/../..').nth(3)

现在,当我们尝试遍历此列表时,获取一个元素的 xpath 并将另一个元素添加到此 xpath 中,我们遇到了问题。因为当我们使用 catenate 或尝试以任何方式连接两个不同的定位器时,我们得到了这样的定位器。waiting for locator('xpath=//*[@class="status-label status-label--active"]/../..').nth(9//*[@class="table-main__actions-list table-main__actions-list--visible"])

有什么办法可以解决吗?或者也许有一些解决方法?因为我们有很多测试都使用“compount”xpath 选择器。 你能帮忙吗?

我试图通过使用Get From List关键字来解决这个问题,但没有结果

robotframework 关键字 robotframework-browser

评论


答: 暂无答案