In Selenium IDE, can I store an element to use in subsequent asserts?
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 开发者_Python百科'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?
You can use the assignId
command to temporarily assign a value to the element's id
attribute. For example:
assignId | //table//td[.='case_1']/.. | myRow
assertText | id=myRow | Some text
assertText | id=myRow | Some other text
you can use xpath=${row}
see Selenium: Is it possible to concatenate an xpath with a variable? (second response)
精彩评论