Thanks for the help Paul.  I did have one question about this method,
however:
 
As far as putting indexes and the name you want in the Hash array, does
this assume that the indexes of certain elements are constant through
the website?  The reason that I didn't use index navigation inititally
was because as each div is clicked and activated, the div indexes around
the page appear to change.  While at first the "Home" div is #7, after
being clicked it becomes #9.  Would this throw a wrench in the gears of
your script?
 
There's a very good chance I've just missed the point, but that's how I
understand it so far.
 
Thanks again,
Adam

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Carvalho
Sent: Friday, March 16, 2007 3:23 PM
To: [email protected]
Subject: Re: [Wtr-general] Click on button which isn't a button


Hi Adam, this is the situation we have with our navigation bar for one
of our web apps.  Using Watir 1.4.1 I couldn't use the 'text' attribute
for SPAN tags and none of the Spans had unique ID's.  What I ended up
doing was creating two methods to help us navigate the system. 

The first one is called 'populate_navigation_bar' and the second is
"navigate_bar()".  In the first method, I iterate through all the Div
and Span tags with the desired information and put them into a Hash
array.  The 'values' are the index numbers. 

Then when I want to navigate through the system, I call the
navigate_bar() method and pass it the name I want and the method clicks
the corresponding element using the index number.  This gives me a
certain amount of flexibility in my tests because I can now select
random elements really easily for each test run, navigate to the 'top'
of the list regardless of whatever it's called, and other cool things
like that. 

In Watir 1.5.x, I can now use the 'text' attribute for Spans, but I
decided to keep navigating the system the same way because I have
greater control this way.

That's how I deal with the problem anyway.  Maybe this might work for
you?  Good luck! 

Cheers.  Paul C.



On 16/03/07, Adam Reed wrote: 

        This brings up an interesting issue that came up yesterday.  We
have a new front-end designer on staff who was creating some mockups for
a new project.  I was getting familiar with his code and using watir to
navigate around, and noticed that of the ~90 divs on the page, only 5-6
have unique (or any) id tags.  These unnamed divs make up the primary
navigation system for the site.  There are no images, buttons or tables
on the page.
         
        So of course, not thinking much into it - I ask if it would be
possible for him add unique id tags to the major navigational elements
(50% of the divs are not important to anything other than design).  He
replied, saying that adding unique ids to all elements would wreak havoc
with style sheets, since all of these unnamed divs share the same style
information.  Also, for Search Engine Optimization (SEO), he needs to
keep as much unnecessary text off the page as possible (although this
point is debatable).
         
        In this case, where do we go from here?  I completely understand
his point, but at the same time I would be prevented from automating the
majority of the tests on the new site.  Of course we don't rely 100% on
automation (probably less than 50%), but 100% manual testing requires
quite more time, and produces many fewer test results.
         
        I'd be interested to hear solutions, or just comments on the
issue - I know it has to be fairly common.
         
        -- Adam


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to