需要根据来自 Selenium IDE 脚本中表 td 内部 HTML(使用 storeText 存储变量)的数据来断言文本输入字段的值

软件测试
2022-01-16 17:56:43

在 Selenium IDE 中,我需要对来自不同页面的表(只允许,不允许)assertValue的数据调用输入字段的命令。<td>storeTextstoreValue

现在数据正在正确存储,但我认为该assertValue命令需要一个值变量,而不是文本变量。我从过去的情况中发现,这些与 IDE 不同。

我尝试了以下方法,但没有奏效:

从表标签存储文本变量<td>

Command: storeText
Target: //table[@id='AddressList_List_ListGrid']/tbody/tr[2]/td[5]
Value: var_source_client_billing_address_city

将文本变量存储到值变量中:

Command: storeValue
Target: ${var_source_client_billing_address_city)
Value: var_source_client_billing_address_city_value

上面的命令崩溃,所以我什至不能使用 value 变量来断言 value

在文本输入字段中断言值变量:

Command: assertValue
Target: id=AddressEditor_TxtCity
Value: ${var_source_client_billing_address_city_value}

这也不起作用:

从表标签存储文本变量<td>

Command: storeText
Target: //table[@id='AddressList_List_ListGrid']/tbody/tr[2]/td[5]
Value: var_source_client_billing_address_city

在文本输入字段中断言值变量:

Command: assertValue
Target: id=AddressEditor_TxtCity
Value: ${var_source_client_billing_address_city}
1个回答

我得到了第一组工作,但是为了比较文本变量(用创建storeText)和值变量(用创建storeValue),我只使用了assertExpression.

从表 td 标记内部 HTML 存储文本变量

Command: storeText
Target: //table[@id='AddressList_List_ListGrid']/tbody/tr[2]/td[5]
Value: var_source_client_billing_address_city

将文本变量存储到值变量中

Command: storeValue
Target: ${var_source_client_billing_address_city)
Value: var_source_client_billing_address_city_value

将文本输入字段中的值变量断言为来自 td 内部 HTML 的文本值

Command: assertExpression
Target: ${var_source_client_billing_address_city}
Value: ${var_source_client_billing_address_city_value}