Selenium RC:测试因错误的 selenium 命令而失败
在 Selenium RC JUnit 测试中,我有 2 个 assertTrue 元素。
assertTrue("元素 1 不正确",selenium.isElementPresent("元素 1"));
assertTrue("element2 不正确",selenium.isElementPresent("element2"));
在调试另一个问题时,我故意使 element1 的 xpath 无效。有时测试会因第一个assertTrue语句而失败(预期),但有时会因第二个语句而失败(奇怪),这意味着它通过了第一个assertTrue。
谁能猜出发生了什么事吗?
In a Selenium RC JUnit test, i have 2 assertTrue elements.
assertTrue("Incorrect element1",selenium.isElementPresent("element1"));
assertTrue("Incorrect element2",selenium.isElementPresent("element2"));
While debugging another problem, i purposely made the xpath to element1 invalid. Sometimes the test fails with the first assertTrue statement (expected), but sometimes it fails with the second one (weird) which means it passed the first assertTrue.
Can anyone guess what's happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能有另一个同名的元素,并且它的加载时间可能早于您预期的元素...检查重复的元素。
You might have another element with same name and it may be that it is loading earlier than your expected element...Check for duplicate elements.
我不知道你的页面布局或加载过程,但每当我遇到这样的奇怪问题时,通常是由于页面尚未完成加载,或者某些 JavaScript 尚未运行,或者运行得比预期早。我认为这不是我们正在讨论的静态页面。或者,页面上还有一些具有相同名称或 ID 的其他元素。
I don't know your page layout or load procedure but whenever i've had weird problems like this it's usually down to the page not having finished loading yet, or some JavaScript that hasn't run, or has run sooner that expected. I presume this isn't a static page we're talking about. Or alternately, there is some other element with the same name or ID on the page.