Selenium IDE : Searching the Column of a Table for a Value

503 views
Skip to first unread message

Ricky Byrd, Jr.

unread,
Aug 14, 2014, 6:25:59 PM8/14/14
to seleniu...@googlegroups.com
I'm having some issues trying to search the column of a table for a specific phrase.

I have a large table (3 rows, 350 columns) and I'm trying to search the column of a table for a specific value (i.e. //table[3]/tbody/tr[4]/td).  I'm wondering if there's a way to search through all the rows of the table...


i.e. //table[3]/tbody/tr[search all the rows in the table]/td


... so as to determine of a specific value (i.e. 'bash') is in my 'td' column.


i.e.     
Table:

Name          Version          N/A
cookie         2.3               [BUTTON]
ice              2.3               [BUTTON]
paper          2.3               [BUTTON]
lib               2.3               [BUTTON]
bash           2.3               [BUTTON]
.
.
.
.

The reason I need to search the column rather than look in a specific cell address, is because the variable may be in the table, but will not always be in the same row.

PLEASE HELP!   Thanks ahead of time!!

shrirang vaze

unread,
Aug 16, 2014, 8:47:55 AM8/16/14
to seleniu...@googlegroups.com
Yes you should be to do this with something like this
//table/td[containa(text(),'your expected value')]
Note that you should provide full path to the td(column) in above path.
Hope this helps.

Andrew Deschain

unread,
Aug 18, 2014, 8:30:38 AM8/18/14
to seleniu...@googlegroups.com
I think what shirang means is:
//td[contains(text(), 'value')]

with that you get the first cell containing the desired value. If you only have one table on the page this should work.
If you have multiple tables you can use:
//table[<maybe some identifiers>]//td[contains(text(), 'value')]
(see double slash between table and td)
Reply all
Reply to author
Forward
0 new messages