Several options, the simplest of which is to use the image method.

web_browser.image( :src, /plus.gif/ ).click

You may need to use xpath or multiple attributes to get the second or  
third image.

Hope this helps.

Alex

On 10 Feb 2009, at 23:44, rollo <croll...@gmail.com> wrote:

>
> Hello, Watir Folks.  I've been banging my head for a bit on a test
> step.  I'm hoping someone can see what I'm missing.
>
> I have a simple app that displays a navigation tree.  I need to expand
> one of the "nodes" so I can select a sub-folder.
>
> Here is a snippet of the HTML code that Watir sees.
>
> "<SPAN class=treelabel id=label-NULL*Po*Portfolio*1*-99999-ms__id4
> onmouseover=\"this.className=this.className + 'Hover'\" title=\"Agile
> Projects\" onmouseout=\"this.className=this.className.replace('Hover',
> '')\" type=\"plabel\" NodeId=\"NULL*Po*Portfolio*1*-99999\"
> ParentNodeId=\"\">Agile Projects</SPAN>
> </DIV>\r\n
>
> <DIV class=\"toolTipTarget container\" id=container-
> NULL*Po*Portfolio*1*-99999-ms__id4 style=\"DISPLAY: block; MARGIN-
> LEFT: 36px\" type=\"container\" NodeId=\"NULL*Po*Portfolio*1*-99999\"
> ParentNodeId=\"\">\r\n
>
> <DIV class=parent id=NULL*Po*Portfolio*41*-99999-ms__id4
> title=Products xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"; type=
> \"parent\" IsTaskType=\"False\" Category=\"Portfolio\"xmlsrc=
> \"deeptree-xmlsrcNULL*Po*Portfolio*41*-99999\" NodeId=
> \"NULL*Po*Portfolio*41*-99999\" ParentNodeId=\"\">\r\n
> <DIV class=treetrigger id=trigger-NULL*Po*Portfolio*41*-99999-ms__id4
> style=\"ZOOM: 1\" type=\"ptrigger\" NodeId=
> \"NULL*Po*Portfolio*41*-99999\" ParentNodeId=\"\" hastooltip=\"true\">
>
> <SPAN style=\"PADDING-RIGHT: 5px! important\"><IMG onmouseup=
> \"this.style.marginTop='2px'\" class=treeExpandCollapse id=img-toggle-
> NULL*Po*Portfolio*41*-99999-ms__id4 style=\"MARGIN-TOP: 2px\" alt=\"\"
> src=\"http://sagile.serena.com/Agile/serena/widget/_resources/plus.gif
> \" type=\"toggle\" NodeId=\"NULL*Po*Portfolio*41*-99999\"  
> ParentNodeId=
> \"\"></SPAN>"
>
> What I need to do is "click" the + sign image (plus.gif).  After that,
> the folder that is revealed can be found.
>
> I've tried .div, .span and .link with :id, :text, :xpath, :title,
> and :src without finding this image.
>
> Errors are like...
>
> irb(main):139:0> web_browser.div(:xpath,"//img
> [...@src='plus.gif']/../").flash
> Watir::Exception::UnknownObjectException: Unable to locate element,
> using :xpath, "//i...@src='plus.gif']/../"
>        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:52:in `assert_exists'
>        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:239:in `flash'
>        from (irb):139
>
> Please provide some suggestions how I can reach this image element.
> Thanks.
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to