Okay,
so I've just seen this posting from Bret on the following thread
(http://www.mail-archive.com/wtr-general%40rubyforge.org/msg08637.html) which
seems to clarify things a bit although it still raises some questions for a
non-HTML expert still getting used to Ruby, WATIR and the ins and outs of Web
testing all at once... ;^)
It would seem that I have to do the following:
irb> d=f.divs[7]
irb> l=d.links[1]
irb> l.locate
(if you don't do this the following line will not work!!! Refer to
http://jira.openqa.org/browse/WTR-139)
irb> l.ole_object.currentStyle.backgroundImage
=> "url(\"http://machine/app/css/menubar/overridebutton.gif\")"
After this I can grab any available property that is under currentStyle. What
I can't understand is why I cannot use the style accessor handle, to get what
is required by my test requires me to look under the currentStyle handle.
Probably some HTML ignorance of mine coming through...
Still, with this I can now expand my testing framework to verify these kinds of
tests now. This is pretty cool.
Derek Wong.
>>> "Derek Wong" <[EMAIL PROTECTED]> 17/05/2007 4:59 p.m. >>>
Hi,
I'm working on a test that attempts to verify if certain visual characteristics
are valid on the page as displayed.
Here's the scenario:
Normally a given button control on the page has a particular look if it's
element class is set to "Button".
The HTML for this is <A class="Button" id="LogoutButton"
onclick="logout();return false"
href="http://machine/app/MenuBar.htm#">Logout</A>
In another situation based on some settings in the application the same button
has its element class set to "LogoutOverride Button".
The HTML for this is <A class="LogoutOverride Button" id="LogoutButton"
onclick="logout();return false"
href="http://machine/app/MenuBar.htm#">Logout</A>
BTW, these lines just so happen to be enclosed by a <DIV> tag if this is
relevant.
When the class of the button is "LogoutOverride Button" there is a link to an
associated style sheet file that changes the button imagery to a different
background image (a different image filename). I want to verify that this
imagery filename is in fact the file I am expecting so I want to query the
style attributes associated with the above link element to provide an automated
"visual" detection.
So far in IRB I have tried the following:
irb> puts f.divs[7].html
<DIV id=Logout><A class="LogoutOverride Button" id=LogoutButton
onclick="logout();return false" href="#">Logout</A></DIV>
=> nil
irb> puts f.divs[7].links[1].style.ole_get_methods
[ ... lists all the style properties associated with this element ... ]
=> nil
irb> f.divs[7].links[1].style.backgroundImage
=> ""
I wasn't expecting the last line to yield nothing, I thought it would yield the
filename to the appropriate image.
IE Developer Toolbar in its list of style attributes for this element indicates
that this link has the associated imagery against the property
'background-image' with a value of
'url("http://machine/app/css/blah/overridebutton.gif")'. This is what I
thought I'd see with the last IRB line given above.
So what am I doing wrong here? It looks as if most of the properties that I
have inspected so far have yielded "" with the odd exception e.g. the
accelerator property was correctly reported as being false.
Thanks for any help.
Regards,
Derek Wong.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general