Selenium IDE:获取 table 中的行数

Selenium IDE: Get row count in table

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

当我右击我的 table 时,我只能 assert/verify 以下内容:

目标是

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

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

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

这是一个示例,其中 table id = reports:

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

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

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