isnt Jeffs code kind of over kill for this?

def link_there?
  link_text = "Click Me"
  return @ie.link(:text , link_text).exists?
end  


while 1  # add something here to stop infinite loop
  if link_there?
    @ie.link(:text , link_text).click?
  else
    @ie.link(:text , "Next").click
  end
end



----- Original Message -----
From: Chris McMahon <[EMAIL PROTECTED]>
Date: Tuesday, April 3, 2007 9:04 am
Subject: Re: [Wtr-general] Using Until

> Aha, so you want to click Google's "Next" button?  Take a look at
> this, it might give you some ideas:
> http://testingjeff.wordpress.com/2007/01/27/creating-methods-on-
> the-flyand-bugs-in-google-phonebook/
> 
> Also, if you are unsure how to address a particular page element, take
> a look at the "unittests" folder in the watir directory.  It will be
> in C:/ruby/lib/ruby... somewhere, depending on whether you did a gem
> install or used the one-click installer.
> 
> On 4/3/07, Nicola Kennedy <[EMAIL PROTECTED]> wrote:
> > Sorry, probably my fault for not being clear about how new I am 
> to this.
> >
> > I want the code to do the following things:
> > 1. Check on page for a link.
> > 2. If link not there, press "Next page"
> > 3. If link there, click on it.
> > 4. When next page reached (if step 2 followed), repeat the 
> action of looking for link/clicking next.
> >
> > Am playing around with code, and have come up with following:
> >
> > link = ie.link(:url, "http://www.freeuk.com";)
> >     until link.exists
> >     
> ie.goto("http://www.google.co.uk/search?q=freeuk&hl=en&start=10&sa=N";)>
> >     if link.exists = true
> >       ie.goto(link)
> >     end
> >
> > Am totally aware that this will not work, but it may give my 
> helpers more idea of the details I want!!
> >
> > Thankyou all in advance, and please help!
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
> 
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to