why do you want to click on all of the links? what value do you get out of this.
if its to check that when you click a link the page loads it would make more sense to fire them one at a time then validate that the correct link was clicked On Mon, Jun 29, 2015 at 12:01 PM, Sergiu Cornea < [email protected]> wrote: > Good afternoon guys, > > I was wondering if someone could help me. > > Please correct me if I am wrong as I have just started learning Watir and > Ruby. > > Lets say I have 20 websites to be checked but I don't know the links so > what I am doing it is searching for them using the index value as follows: > > require 'watir-webdriver' > > b = Watir::Browser.new > b.goto "mysite.com" > > b.links.each_with_index do |_, i| > > b.link(index: i).click > end > > This piece of code will go and click on all the links that are available > on the Home page, however, I want it to just click on the internal links > only and not the external ones as well, for example "mysite.com/hello, > mysite.com/howareyou. > > I have found a work around which is that knowing what index the external > websites are you could skip them, however, I believe there must be a way of > skipping them by href or so, but because I am new I don't really know. > > Thank you in advance. > > Regards, > Cip > > This message and its attachments are private and confidential. If you have > received this message in error, please notify the sender and remove it and > its attachments from your system. > > The University of Westminster is a charity and a company > limited by guarantee. Registration number: 977818 England. > Registered Office: 309 Regent Street, London W1B 2UW. > > -- > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
