In Selenium IDE, can I save an element for use in subsequent statements?

I just started using Selenium-IDE (until I watched selenium-RC: if someone tells me that this is the answer to my question, I will look at it)

One of the operations I'm testing generates some output in a table on the next HTML page, but the order of the lines is not predictable.

I can obviously use 'assertTextPresent', but I want to do a little more and check that the various bits of the text are on the same line.

What I would like to do is determine tr by some content, and then use tr in subsequent statements; sort of

storeExpression //table[@id='TABLE_6']/td[.='case_1']/.. row
assertText      ${row}     'Some text'
assertText      ${row}     'Some other text'

to verify that “Some texts” and “Some other texts” appear on the same row in the table, for example, “case_1”.

I don't have this yet, and I'm not sure if this is possible or what syntax to use, if any.

Has anyone been able to do this?

+3
source share
2 answers

You can use the command assignIdto temporarily assign a value to the element attribute id. For instance:

assignId | //table//td[.='case_1']/.. | myRow
assertText | id=myRow | Some text
assertText | id=myRow | Some other text
+4
source

you can use xpath = $ {row}

see Selenium: is it possible to combine xpath with a variable? (second answer)

+1
source

Source: https://habr.com/ru/post/1746170/


All Articles