在 Selenium IDE 上,如何断言标签之间的文本值?
On Selenium IDE, how to assert the text value in between tags?
源码是这样写的:<div class="qa">on</div>
我想在 Selenium IDE 中断言 <div ...>
和 </div>
之间的值是“on
”。
我尝试使用 assertValue 和 assertAttribute,但这两个命令都出现错误。如果我对 xpath=//div[@class='qa']
/ 使用 assertElementPresent,它会通过,但它不会断言 <div>
之间的值是“on
”。
使用assertText
(如果测试不应在失败时停止,则使用verifyText
):
assertText xpath=//div[@class='qa'] exact:on
来自参考:
assertText(locator, pattern)
Generated from getText(locator)
Arguments:
- locator - an element locator
Returns:
- the text of the element
Gets the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like
browsers) or the innerText (IE-like browsers) of the element, which is
the rendered text shown to the user.
源码是这样写的:<div class="qa">on</div>
我想在 Selenium IDE 中断言 <div ...>
和 </div>
之间的值是“on
”。
我尝试使用 assertValue 和 assertAttribute,但这两个命令都出现错误。如果我对 xpath=//div[@class='qa']
/ 使用 assertElementPresent,它会通过,但它不会断言 <div>
之间的值是“on
”。
使用assertText
(如果测试不应在失败时停止,则使用verifyText
):
assertText xpath=//div[@class='qa'] exact:on
来自参考:
assertText(locator, pattern)
Generated from getText(locator)
Arguments:
- locator - an element locator
Returns:
- the text of the element
Gets the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user.