table_to_ array

48 views
Skip to first unread message

Fukaya Yoshikazu

unread,
Oct 10, 2008, 3:15:15 AM10/10/08
to watir-...@googlegroups.com
Please let me know how to get a html table into ruby array.
then I can use the table again without accessing to html.
 
thanks
 

Daniel Vartanov

unread,
Oct 10, 2008, 4:29:01 AM10/10/08
to watir-...@googlegroups.com
Hi, Fukaya.

you can access cells in the following way:

cell = table[1][2] # second cell of the first row

Also:

table.rows # array of table rows (TableRow objects)
table[1].cells # array of first row cells (TableCell objects)

Of course, it simply can be converted to array of arrays of cell contents.

Regards,
Daniel Vartanov.

marekj

unread,
Oct 10, 2008, 3:59:08 PM10/10/08
to watir-...@googlegroups.com
have you tried table(how, what).to_a
http://wtr.rubyforge.org/rdoc/classes/Watir/Table.html#M000391
be careful about nested tables.
--
marekj

www.testr.us | semantic test objects modeling in watir
Reply all
Reply to author
Forward
0 new messages