On thing about Watir is that it generally does what the browser does, so if
you really click on a DIV to perform an action on a web site, then using
Watir click on the DIV. This may be the case here with your situation,
though I am not certain how Excite Mail is actually structured (your HTML
example is obviously trimmed down quite a bit), and I don't see and links
(<A HREF="...">...</A> tags). Anyway for example, if I have a DIV that is
like this:

<div class="navigationLink" onclick="javascript: logMeOut();">Logout</div>

Then I could just go

div(:class, "navigationLink").click

likewise let's say that I have this structure, and no other "links" are
located under it. i.e. this is the exact structure:

<div class="navigationLink" onclick="javascript: logMeOut();">
  <div>
    <div>
      <div>
        Logout
      </div>
    </div>
  </div>
</div>

Then I can still do

div(:class, "navigationLink").click

and the browser will feel the click down at the bottom..actually it feels it
at the top, but the link the user would see is at the bottom.

Nathan

On Thu, Oct 9, 2008 at 12:38 PM, NS <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I am new to Ruby and Watir and as my first assignment, I am trying to
> fix the ruby script which automated the opening and browsing messages
> in the Excite Mail. After Excite changed interface, the script has
> been failing.
>
> I used IE toolbar to see the underlying elements in the page and it
> seems that it is lots of nested divs before you find an actual #text
> which provides the visible text for the link.
>
> I am not sure how to access the divs deep down to find the text value
> I want and than click it.
>
> The structure of HTML for "Logout" link looks like this.
>
> <DIV class=ApplicationHeader id=ApplicationHeader>
>  <DIV class=NavigationBar>
>    <DIV class=NavigationBar_Padding>...</DIV>
>    <DIV class=NavigationBar_logo>...</DIV>
>    <DIV class=NavigationBar_buttons>...</DIV>
>    <DIV class=NavigationBar_extra>
>      <DIV class=NavigationBar_Search>
>      <DIV class=NavigationBar_Links>
>        <DIV class=NavigationLink>...</DIV>
>        <DIV class=NavigationLink>...</DIV>
>        <DIV class=NavigationLink>...</DIV>
>        <DIV class=NavigationLink>
>          <DIV class=NavigationLink_Icon>...</DIV>
>          <DIV class=NavigationLink_text>
>             #text
>
> I tried following but it didn't work.
>
>         if ($ie.div(:id, "ApplicationHeader").div(:index,
> 1).div(:index,4).div(:index,2).div(:index,4).div(:text,/
> Logout/).exists?)
>            thr = Thread.new{$ie.div(:id,
> "ApplicationHeader").div(:index,1).div(:index,4).div(:index,
> 2).div(:index,4).div(:text,/Logout/).click}
>            if (thr.join(MaxPageLoadWait).nil?)
>              thr.exit
>            end
>            debug "Clicked logout link"
>          end
>
> I am able to find the div ApplicationHeader using following
>
> $ie.div(:id, "ApplicationHeader")
>
>
> Any help would be highly appreciated.
>
> Thanks,
> Nisha
>
> >
>


-- 
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com

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

Reply via email to