0

使用 Selenium IDE 为网页创建一些测试用例,我发现了这种情况:在 DIV 标签内(被 CSS 隐藏)有很长的文本。我想找到一种解决方案来自动检查此文本的一小部分是否与正则表达式定义的字符串匹配(例如:*check*this*)。最初的想法是使用带有 glob:*check*this* 的 verifyTextPresent 命令,但似乎这个想法不喜欢,因为该元素是隐藏的。

我也在考虑使用“SEO”技巧将隐藏的 DIV 通过 CSS 更改为隐藏的(或几乎)文本,使用不同的解决方案,例如将其放在尺寸为 1x1 或 0x0 的文本区域中......

有什么前进的暗示吗?

谢谢!

4

1 回答 1

0
storeVisible ( locator, variableName )

确定指定元素是否可见。通过将 CSS 的“visibility”属性设置为“hidden”或将“display”属性设置为“none”,可以将元素呈现为不可见,无论是元素本身还是其祖先。如果元素不存在,此方法将失败。

论据:

    locator - an element locator
    variableName - the name of a variable in which the result is to be stored.

回报:

true if the specified element is visible, false otherwise

相关断言,自动生成:

    assertVisible ( locator )
    assertNotVisible ( locator )
    verifyVisible (locator )
    verifyNotVisible ( locator )
    waitForVisible ( locator )
    waitForNotVisible ( locator )
于 2013-04-30T10:05:45.033 回答