Actually managed to work this one out on my own :-) you use class_name

e.g.

if b.div(:id, "hello").class_name == "blah"
puts "blah"
else
puts "not blah"
end


On Friday, 12 October 2012 18:36:42 UTC+1, Adrian Killens wrote:
>
> <div id="blah" class="item45">
>
> Using the above as an example, how would I write an if statement that was 
> something along the lines of
>
> if item with id blah is class 'item45'
> then do something
>
> I can do this with other attributes such as Size but seem to be unable to 
> do this with class
> For example, this works:
> if b.div(:id, "blah").size = 1
> puts "blah"
> else
> puts "not blah"
> end
>
> But this doesn't:
> if div(:id, "blah").class == 'hello'
> puts "blah"
> else
> puts "not blah"
> end
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to