Selenium IDE - 验证隐藏/可见验证消息?
我正在尝试测试一个具有多个文本框的网页。每个文本框都有自己特定的隐藏验证消息。
在输入错误值之前,我使用 'verifyNotVisible' 来确认没有向用户显示验证消息。这部分进展顺利。
之后,我输入无效字符以显示验证消息。
我现在遇到的问题是,虽然验证消息对我来说是可见的,但在输入无效字符后,Selenium 仍然在 'verifyVisible' 行失败。
以下是我在 Selenium 中的内容:
完整图片: https://i.sstatic.net/W5RrH.png< /a>
请注意,在输入无效字符之前,验证消息将被设置为隐藏。此外,'assertValue' 和 'verifyTextPresent' 都会在显示验证消息之前和之后传递。
有谁知道如何让 Selenium 正确通过“verifyVisible”部分?
There's a webpage I'm trying to test that has multiple textboxes. Each textbox has its own specific validation message that is hidden.
Before an incorrect value is entered, I am use 'verifyNotVisible' in order to confirm that there is no validation message being shown to the user. This part passes just fine.
Afterwards, I have selenium type in invalid characters to make the validation message show.
The problem I'm having at this point is that while the validation message is visible to me, Selenium is still failing at the 'verifyVisible' line right after entering the invalid characters.
The following is what I have in Selenium:
Full Image: https://i.sstatic.net/W5RrH.png
Note that the validation messages are set to hidden prior to having invalid characters entered. Additionally, both 'assertValue' and 'verifyTextPresent' are passing before and after the validation message is being shown.
Does anyone know of a way to have Selenium pass the 'verifyVisible' portion correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要插入适当的等待期。如果您在插入无效字符后立即检查
verifyVisible
,那么在进行比较时修改后的 DOM 可能还不存在。例如,查看 Selenium 的
clickAndWait
以了解如何包装适当的暂停。You may need to insert an appropriate wait period. If you are checking
verifyVisible
immediately after inserting your invalid character the modified DOM might not yet be there at the point your comparison is being made.Take a look, for example, at Selenium's
clickAndWait
to see how to wrap an appropriate pause.