【问题标题】:Selenium IDE: Get row count in tableSelenium IDE:获取表中的行数
【发布时间】:2016-12-29 13:57:28
【问题描述】:

如何使用 Selenium IDE 获取给定表的行数?

当我右键单击我的表时,我只能断言/验证以下内容:

  • 标题
  • 价值
  • 文字
  • 元素存在

目标是

//div[@id='reports']/div[n]` where `n` is the number of rows.

【问题讨论】:

  • @ThiagoCustodio 我做了,两个答案都无关紧要。一个是用于 Selenium WebDriver 的,另一个是过时的或不正确的。虽然我只是想出了一个解决方案

标签: selenium testing automated-tests selenium-ide


【解决方案1】:

您想使用storeXpathCount 命令。这需要两个参数,它们可以存储在 IDE TargetValue 字段中,其中以下参数分别是:

  • xpath:要计算的 xpath 表达式
  • 变量名

这是一个例子,其中表id = reports

Command: storeXpathCount
Target: //div[@id='reports']/div[n]/table/tbody/tr
Value: myVarCount

上面的div[n] 中的n 是您的div 编号。

提示:在打开 Selenium IDE 的情况下右键单击您的表以快速获取路径!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-22
    • 2020-09-28
    • 2021-08-21
    • 1970-01-01
    • 2011-01-13
    • 1970-01-01
    • 2023-04-06
    相关资源
    最近更新 更多