【问题标题】:Is it possible to wait for two Web Elements at the same time in Robot Framework via Xpath?是否可以通过 Xpath 在 Robot Framework 中同时等待两个 Web 元素?
【发布时间】:2021-09-14 10:36:03
【问题描述】:

我有两个 Web 元素,如果其中一个出现,它应该触发一个关键字。 但是我在网上找不到任何东西可以将 OR/AND 之类的逻辑操作连接到我的 XPATH 中... 有没有可能的解决方法??

Wait Until Element Is Visible ||| //body/div[@id='app']/div[${count1}]/div[${count2+2}

但触发器应该是 ${count2+2} 或 ${count2+1}

【问题讨论】:

  • 显示您的代码试验和错误?
  • 这个问题清楚吗?

标签: xpath robotframework element wait keyword


【解决方案1】:

首先:这不是机器人框架的问题,而是关于如何使用 xpath 并识别页面中的元素。

所以如果你想搜索 1 个 div 或另一个 div,只需找到清楚识别每个 div 的“事物”然后:

//div[@this='first' or @that='second']

如果元素位于不同的节点/级别,您总是可以这样做:

(//div[@this='first']) | (//div[@that='second'])

【讨论】:

  • 非常感谢!
猜你喜欢
  • 1970-01-01
  • 2017-02-21
  • 2022-01-20
  • 2016-09-30
  • 1970-01-01
  • 2021-03-27
  • 2021-03-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多