I personally dont think this is a good way to test a site but to help you out you could possibly
take your collection of all the links make a new collection that you will use to hold site specific links iterate thru all of the links and add them to the site specific links collection then use your existing code to run thru the specific links collection click on a link validate that the link took you to the right place maybe reset the browser back to the home page repeat On Tue, Jun 30, 2015 at 6:28 AM, Sergiu Cornea < [email protected]> wrote: > Hello Oscar, > > Thank you very much for your answer. > > Yes, that's precisely what I am trying to do, however, as I am new to > Watir and Ruby I was struggling to achieve that. Therefore, after doing > some research on Google I have discovered that so that's why I was trying > to implement it. > > Could you please let me know how should I go about implementing it? > > Thank you, > > Kind regards, > Cip > > On Monday, 29 June 2015 19:24:07 UTC+1, Oscar.Rieken wrote: >> >> 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. >>> >> >> > 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.
