On Apr 2, 2:06 pm, Tester78 <hmtest...@gmail.com> wrote:
> I am really new to watir and need some help on how to go about testing
> this case. I am trying to test a next button on a page.   If I am on
> the homepage(http://example.com/1.aspx.com) and click the next button,
> I am taken to the next page with the url(http://example.com/
> 2.aspx.com). If I hit next again the ending url changes to 3.aspx and
> so on.

George gives you the basic tactic to get the url

If I was testing this I'd do as follows
(note that I'm not really showing full validations, because don't know
if you are using test unit asserts rspec shoulds, or some custom
validation class you wrote.  so I'm just going for what I'd look at.
obviously just calling the 'exists' method without doing anything with
the return value tests nothing realy...)

1) browser.button(:class, 'next').exists?  #is the button there?  no
point to steps 2 or 3 if not.
2) the button has the right href
3) click the button
4) check url of resulting page, is it as expected. (in a sense this is
just testing the browser, but it also verifies that the page is
present on the server, and/or you are not being redirected to
somewhere unexpected)

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: 
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to