Selenium IDE - Can I select a row based on column content to verify other columns?
selenium, selenium-ide
Solution
The solution I found was to use the Selenium's `storeElementIndex` command. It gets the index of an HTML element relative to its parent.
See http://release.seleniumhq.org/selenium-core/1.0.1/reference.html
I changed the test as follows:
store || //form/table || tableXpath
storeElementIndex || ${tableXpath}//tr/td[text() = "Initials"]/.. || initialsRow
verifyTable || ${tableXpath}.${initialsRow}.1 || MJ
verifyTable || ${tableXpath}.${initialsRow}.2 || MH
The XPath query `//form/table//tr/td[text() = "Initials"]/..` finds the 'tr' element above the 'td' element containing the text "Initials". Selenium stores the index of this 'tr' element relative to whatever its parent element is.
Problem
I am testing an application using Selenium IDE. There is a table with unstable row ordering - which means the elements I need to verify are in different rows on each test run. I'd like to use text known to be in the first column to find the row; and then verify the other columns in the same row. The test looks like this: ``` store || //form/table || tableXpath store || 3 || initialsRow verifyTable || ${tableXpath}.${initialsRow}.0 || Initials verifyTable || ${tableXpath}.${initialsRow}.1 || MJ verifyTable || ${tableXpath}.${initialsRow}.2 || MH ``` Instead of hard-coding the "initialsRow" value; is it not possible to find the row index dynamically?