[Wtr-general] assertion on the color of the row of a table

Željko Filipin zeljko.filipin at gmail.com
Wed Jan 3 04:04:24 EST 2007


I forgot to ask you to post your html.

If you have html that looks like this

<table>
<tr>
<td bgcolor=red>
text
</td>
</tr>
</table>

you can get the html of cell with this (watir 1.5.1.1081)

irb(main):005:0> ie.table(:index, 1)[1][1].html
=> "\r\n<TD bgColor=red>text </TD>"

If you want to see if there is text "red" (without quotes) this will do it

irb(main):012:0> ie.table(:index, 1)[1][1].html.match("red")
=> #<MatchData:0x2e01170>

Just to make shure, it would return nil for any other colour

irb(main):014:0> ie.table(:index, 1)[1][1].html.match("black")
=> nil

I could be more precise if you posted a html snippet.
-- 
Zeljko Filipin
zeljkofilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070103/0dbe6ed6/attachment.html 


More information about the Wtr-general mailing list