this line
str_value=$browser.span(:id,
"MainLogin_UserNameRequired").attribute_value("style")
has given you the whole IE style object, you need to get the visibility part of
it
str_value=$browser.span(:id,
"MainLogin_UserNameRequired").attribute_value("style").invoke("cssText")
might give you what you want ( as a string, then use a regexp on it)
or try
str_value=$browser.span(:id,
"MainLogin_UserNameRequired").attribute_value("style").invoke("VISIBILITY")
may hvae to try lowercase as well
I had to do something like this ages ago, and I think I used the cssText method
Paul
----- Original Message -----
From: Brad <[EMAIL PROTECTED]>
Date: Wednesday, January 3, 2007 1:56 pm
Subject: Re: [Wtr-general] How to verify if SPAN is visible
> Thank you all for replying to this thread and answering my
> question.<br><br>
> Angrez, I had difficulty using 'attribute_value'. Here is how I
> used it along with the html code.<br><br>
>
> HTML Code:<br>
> <tTD><iINPUT id=MainLogin_UserName name=MainLogin$UserName> <sSPAN
> id=MainLogin_UserNameRequired title="User Name is required."
> style="VISIBILITY: hidden; COLOR: red"
> controltovalidate="MainLogin_UserName" errormessage="User Name is
> required." validationGroup="MainLogin" initialvalue
> isvalid="true">*</sSPAN></tTD></tTR><br><br>
> Ruby/Watir Code:<br>
> str_value=$browser.span(:id,
> "MainLogin_UserNameRequired").attribute_value("style")<br> puts
> str_value<br><br>
>
> Output:<br>
> #<WIN32OLE:0x2c4d108>
> <br><br>
>
> I do have two solutions that work (see below) but I'm curious of
> how this might work. One other thing, for others, is the
> 'attribute_value' does not work for Watir version 1.4; use
> 1.5.<br><br>
> Zeljko, thanks this worked.<br><br>
>
> nchristie, thanks this worked.<br><br>
>
> I did not try the 'walk DOM tree for checking of disabled or non-
> visible elements'; this looks 'advanced'. :) <br><br>
>
> Brad
> -------------------------------------------------------------------
> --
> Posted via Jive Forums
> http://forums.openqa.org/thread.jspa?threadID=5879&messageID=16765#16765
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general