在 Selenium IDE 中,我可以存储一个元素以在后续断言中使用吗?
我刚刚开始使用 Selenium-IDE(尚未查看 selenium-RC:如果有人告诉我这是我问题的答案,我会查看它)
我正在测试的操作之一会在表位于下一个 HTML 页面中,但行的顺序不可预测。
显然我可以使用“assertTextPresent”,但我想做更多,并检查不同的文本位是否位于同一行。
我希望能够做的是通过某些内容来识别 tr,然后在后续断言中使用该 tr;例如
storeExpression //table[@id='TABLE_6']/td[.='case_1']/.. row
assertText ${row} 'Some text'
assertText ${row} 'Some other text'
检查“某些文本”和“其他文本”是否与“case_1”出现在同一表行中。
到目前为止我还没有让它工作,我不确定它是否可能,或者如果可能的话使用什么语法。
有人设法做到这一点吗?
I've just started using Selenium-IDE (not looked at selenium-RC yet: if somebody tells me that that is the answer to my question I'll look at it)
One of the operations I'm testing generates some output in a table in the next HTML page, but the order of the rows is not predictable.
I can obviously use 'assertTextPresent', but I want to do a bit more, and check that various bits of text are in the same row.
What I would like to be able to do is to identify a tr by some content, and then use that tr in subsequent asserts; something like
storeExpression //table[@id='TABLE_6']/td[.='case_1']/.. row
assertText ${row} 'Some text'
assertText ${row} 'Some other text'
to check that 'Some text' and 'Some other text' occur in the same table row as 'case_1'.
I haven't got this to work so far, and I'm not sure whether it is possible, or what syntax to use if it is.
Has anybody managed to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
assignId
命令临时为元素的id
属性分配一个值。例如:You can use the
assignId
command to temporarily assign a value to the element'sid
attribute. For example:您可以使用 xpath=${row}
参见 Selenium:是否可以将 xpath 与变量连接起来?(第二个响应)
you can use xpath=${row}
see Selenium: Is it possible to concatenate an xpath with a variable? (second response)