From chrisrose.chrisrose at gmail.com Mon Nov 26 09:34:05 2007 From: chrisrose.chrisrose at gmail.com (Christopher Rose) Date: Mon, 26 Nov 2007 09:34:05 -0500 Subject: [SafariWatir-general] links method for Watir::Safari object? Message-ID: <76254f0711260634o42e7dbem8de9b490e91f4f4d@mail.gmail.com> Hi all, I was just trying some of my watir scripts out with safariwatir, and the first thing I notice is that there is no method 'links' for the Watir::Safari object, as there was for the Watir::IE object. Is this something yet to be implemented for safariwatir? (More likely, I am just doing something wrong - please LMK). Or maybe there's a way to get the whole links collection from the 'link' method? Just as an example, here is a ruby script snippet which produces the error; handle.goto(nextUrl) tmpLinkList = handle.links tmpLinkList.each { |nextLink| print "Found a link labelled " + nextLink.text + ".\n" testLinkHandle.goto(nextLink.href) And the error I get is like this; NoMethodError: undefined method `links' for # Thanks for any info or suggestions - Chris From pirkka at gmail.com Mon Nov 26 14:38:17 2007 From: pirkka at gmail.com (Pirkka Hartikainen) Date: Mon, 26 Nov 2007 21:38:17 +0200 Subject: [SafariWatir-general] Watir seems to "fast" for my application Message-ID: <2b75aeb90711261138l2b541a67p7076a3006cdc37ea@mail.gmail.com> Hi! I wrote couple of useful tests for my app using SafariWatir. My problem is that most of the time, the application respons too slowly to requests and Watir fails with, for example, "Watir::Exception::UnknownObjectException" trying to find an element that just hasn't still been loaded. Is there a way to make Watir wait a little bit longer for the pages to load? How does Watir know that page loading has finished? Best Regards, Pirkka From sweettoother at gmail.com Mon Nov 26 14:39:03 2007 From: sweettoother at gmail.com (Sweet Toother) Date: Mon, 26 Nov 2007 12:39:03 -0700 Subject: [SafariWatir-general] links method for Watir::Safari object? Message-ID: <8192f4360711261139g299c532bqf62982d7a6d76dbc@mail.gmail.com> I was wondering the same thing. In my case, I need to locate a link by its class and get the text of that link. e.g. for this HTML: --------------------------------------------- MySite --------------------------------------------- I want to do the following: ------------------------------------------- brw = Watir::Safari.new brw.goto("file:///myhome/Development/www/test.html") l = brw.link(:class, "myclass") t = l.text --------------------------------------------- But I get the error: NoMethodError: undefined method `operate_by_class' for # from /Library/Ruby/Gems/1.8/gems/safariwatir-0.2.5/./safariwatir.rb:74:in `send' from /Library/Ruby/Gems/1.8/gems/safariwatir-0.2.5/./safariwatir.rb:74:in `operate' from /Library/Ruby/Gems/1.8/gems/safariwatir-0.2.5/./safariwatir/scripter.rb:120:in `get_text_for' from /Library/Ruby/Gems/1.8/gems/safariwatir-0.2.5/./safariwatir.rb:128:in `text' from (irb):5 I'm running safariwatir 2.5 in irb 0.9.5 on ruby 1.8.6-36, on OS X 10.5.1. I'm new to ruby and watir, so I've been guessing that I was doing something wrong. :) 'later... From pirkka at gmail.com Tue Nov 27 06:38:17 2007 From: pirkka at gmail.com (Pirkka Hartikainen) Date: Tue, 27 Nov 2007 13:38:17 +0200 Subject: [SafariWatir-general] Watir seems to "fast" for my application In-Reply-To: <7957272F-58DC-4AB2-8005-909FE5851853@carbonplanet.com> References: <2b75aeb90711261138l2b541a67p7076a3006cdc37ea@mail.gmail.com> <7957272F-58DC-4AB2-8005-909FE5851853@carbonplanet.com> Message-ID: <2b75aeb90711270338q69abd55crd1e1c4e1c692271f@mail.gmail.com> Thanks Thomas for your reply - adding sleep manually was the first idea that popped into my mind as well, but I find it adds way too much clutter to even start considering. Would there be a way to "inject" this sleep procedure somehow to Watir so that Watir would always sleep before doing certain actions? That would be an alternative to having Watir actually figure out whether that page has been loaded or not. It's funny, somehow I assumed that Watir would wait for the pages to load by default. But I guess it's not that simple. Pirkka On 26/11/2007, Thomas Tuddenham wrote: > Had a similar problem with tests that worked fine on one machine > (grunty dual-core machine) but not on another (tired on G4). The only > hacky solution that worked for me was to call sleep between operations. > > sleep 5 > > between calls to the Safari object seemed to work - dodgey for sure, > and I hope there has to be a better way > > Cheers > Tom > > On 27/11/2007, at 6:08 AM, Pirkka Hartikainen wrote: > > > Hi! > > > > I wrote couple of useful tests for my app using SafariWatir. My > > problem is that most of the time, the application respons too slowly > > to requests and Watir fails with, for example, > > "Watir::Exception::UnknownObjectException" trying to find an element > > that just hasn't still been loaded. > > > > Is there a way to make Watir wait a little bit longer for the pages to > > load? How does Watir know that page loading has finished? > > > > Best Regards, > > Pirkka > > _______________________________________________ > > SafariWatir-general mailing list > > SafariWatir-general at rubyforge.org > > http://rubyforge.org/mailman/listinfo/safariwatir-general > > > > From dave at obtiva.com Tue Nov 27 06:55:30 2007 From: dave at obtiva.com (Dave Hoover) Date: Tue, 27 Nov 2007 05:55:30 -0600 Subject: [SafariWatir-general] Watir seems to "fast" for my application In-Reply-To: <2b75aeb90711270338q69abd55crd1e1c4e1c692271f@mail.gmail.com> References: <2b75aeb90711261138l2b541a67p7076a3006cdc37ea@mail.gmail.com> <7957272F-58DC-4AB2-8005-909FE5851853@carbonplanet.com> <2b75aeb90711270338q69abd55crd1e1c4e1c692271f@mail.gmail.com> Message-ID: <11c8704e0711270355v1b4c2ff2gdd41359ad76eeb60@mail.gmail.com> On 11/27/07, Pirkka Hartikainen wrote: > It's funny, somehow I assumed that Watir would wait for the pages to > load by default. But I guess it's not that simple. It does try to wait for pages to load by default, but there are some insidious timing issues that I haven't been able to solve, mostly due to the fact that I haven't been able to replicate the issues on my laptop ... and due to a lack of time to work on the project. If anyone is feeling brave, they could have a look at the page_load method in http://safariwatir.rubyforge.org/svn/trunk/safariwatir/scripter.rb (bottom of file) and let me know if anything jumps out at them. Best, --Dave