[wtr-general] Help with Watir Page Checkers
Hi, I am currently testing a web app that depends on some sort of webservice to be running in the background and i find the web service goes into an unavailable state frequent, so i thought it was best i use watir page checkers so that as soon as the page under test is loaded, i can check for either 4xx or 5xx errors and the test should just stop and not continue. This is what i have done def navigate(page_name) begin browser.goto(http://www.xx.com;) browser.check_for_http_error # will throw Exception end rescue Watir::Exception::NavigationException = e #catch the Exception puts Page did not load: #{e} # = 'Cannot find server or DNS Error' end I have a test structured in way that 1. The navigate method is called 2. Then some other checks is done on the page What i expect is that the tests should terminate at line 1 , and give an error message 'Cannot find server or DNS Error' But this doesnt work, the test continue to line 2 to do some assertions which then fails but i would love to be able to catch the error at line 1. I have also tried def navigate(page_name) browser.add_checker(PageCheckers::NAVIGATION_CHECKER) begin browser.goto(http://www.xx.com;) end rescue Watir::Exception::NavigationException = e #catch the Exception puts Page did not load: #{e} # = 'Cannot find server or DNS Error' end And i also tried excuting the code in irb, it prints false to screen, I would appreciate any help -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
Re: [wtr-general] Help with Watir Page Checkers
On Tue, Mar 2, 2010 at 3:23 PM, yoggy samuelades...@googlemail.com wrote: rescue Watir::Exception::NavigationException = e You are rescuing the exception, hence the script is not terminated. You should do something like this: def navigate(page_name) browser.check_for_http_error rescue Watir::Exception::NavigationException = e puts Page did not load: #{e} raise end Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
Re: [wtr-general] Re: execution expired
I just see the source code of watir's ie.wait(). according to your description,the doc should load completely. i think there maybe a activex control that can't be loaded or not loaded. please check the page code if it like this: 'new activex()'. at last,you can test it directly again but not from proxy. hope it is useful for you. 在 Tue, 02 Mar 2010 03:16:30 +0800,hliauw hli...@gmail.com 写道: Windy, thanks a bunch. toutval is currently set to 30s and 40s respectively. The url is an internal test page with just 9 images in it. I tested the url manually from the same machine and it loads within 1-2s. I should say that we are actually using watir+browser to test a proxy server so there is a possibility of an error there. However, we already looked at the proxy logs and it shows that it already sent all the images back to the browser. On Mar 1, 12:27 pm, windy lyfi2...@sina.com wrote: method Timeout::timeout throw Timeout::Erorr exceptions,it happens if browser can't open or open it too slow. you should test the url manual,or increase var 'toutval'. ÔÚ Tue, 02 Mar 2010 01:17:53 +0800£¬hliauw hli...@gmail.com дµÀ: Hi, can somebody help me understand the following exceptions? it happened on both ie and firefox goto call. E, [2010-03-01T04:11:28.918000 #2884] ERROR -- : Exception in goto: execution expired: [C:/Ruby/lib/ruby/1.8/timeout.rb:60:in `wait', C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb: 355:in `goto', C:\\myFolder/myWrapperFile.rb:64:in `goto', C:/Ruby/ lib/ruby/1.8/timeout.rb:62:in `timeout', C:\\myFolder/ myWrapperFile.rb:62:in `goto', C:/myFolder/myTestFile1.rb:30] E, [2010-02-27T04:13:58.575000 #3888] ERROR -- : Exception in goto: execution expired: [C:/Ruby/lib/ruby/1.8/timeout.rb:60:in `read_socket', C:/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jssh_socket.rb:6:in `js_eval', C:/Ruby/lib/ruby/gems/1.8/ gems/firewatir-1.6.5/lib/firewatir/firefox.rb:492:in `wait', C:/Ruby/ lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:196:in `goto', C:\\myFolder/myWrapperFile.rb:64:in `goto', C:/Ruby/lib/ ruby/1.8/timeout.rb:62:in `timeout', C:\\myFolder/myWrapperFile.rb: 62:in `goto', C:/myFolder/myTestFile2.rb:26] here is the relevant code in myWrapperFile.rb starting from line 62: Timeout::timeout(toutval) do begin browser.goto(url) rescue Timeout::Error logger.error(goto call got hung after #{toutval}s); rescue Exception = e logger.error(Exception in goto: #{e.message}: #{e.backtrace.inspect}); end end -- ʹÓà Opera ¸ïÃüÐԵĵç×ÓÓʼþ¿Í»§³ÌÐò:http://www.opera.com/mail/ -- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/ -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
Re: [wtr-general] Re: Watir freezing when clicking on links
Thanks for your feedback Adam. In my case there are about 500 pages being loaded. It seems to be more of a VMware issue though because sometimes a regular filedownload that I have initiated manually will hang also. I noticed that the problem got much worse when I started using Watir in a VM that is stored on a server (I.e. the virtual disk file is on a file server). My Watir tests haven't ever hung when I'm running them on a physical machine rather than a VM. On Tue, Feb 23, 2010 at 16:58, AR reed.a...@gmail.com wrote: Is there a chance you're testing a great number of pages? My only experience with this behavior was for testing around 20k pages in one script -- Internet Explorer would always croak after 5-8k pages. I switched to WWW::Mechanize for that script and it ran to completion. My tests were also on VMware boxes. Thanks, Adam On Feb 23, 4:10 am, Frank Harper frank.har...@gmail.com wrote: I have noticed that clicks sometimes seem to get lost between Watir and IE. When this happens my script will hang (infinite wait?). In this case if I manually click on the link, it unhangs the script. Up until now, I have only seen this happen when running Watir on a VMware virtual machine. I was wondering if anyone else has seen this happen? Could it be a timing issue? Are there any known workarounds? -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Calendar on a javascript driven page
Thanks so much. After some experimenting, it looks like fire_event(mousedown) does the trick Much appreciated! On Mar 2, 6:52 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Mar 2, 2010 at 12:42 PM, xguarder shams...@gmail.com wrote: Doing the .click method does not properly mimic the manual mouse click. You probably have to fire a JavaScript event. Something like this: $browser.cell(:class = /available/, :index = 1).fire_event(onmouseclick) Ask the developer which event should be fired. Event Spy Firefox add-on could help too: https://addons.mozilla.org/en-US/firefox/addon/1100 Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Help with Watir Page Checkers
I have included the raise and it doesnt work still. I also removed the rescue and puts line still this doesnt work, My test stak is using Cucumber + Watir, could this be a reason ... Confused :( -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Confused about array declaration failure (rspec, watir)
This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). In a nutshell, the script goes to a static page, collects the links, visits each linked page and verifies an item - it has been significantly dumbed down for the purpose of this question and I have tested this simplified version to make sure it gives the same output. Can someone help me understand why my array here (@countries) is not recognized? I tried to instantiate it as a global variable ($countries) and it still was not recognized. Is it an issue with my organization/format, or something else? Again, if I explicitly describe an array in place of the variable, the script works . global_page_spec.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/example_helper' describe The country page for do include ExHelper before(:all) do setup collect_global_countries end @countries.each do |name, link| describe name do it should contain the word #{name} in the title do @browser.goto link @browser.div(:id, /content-content/).text.should include(name) end #it end #desc end #countries after(:all) do teardown end #after end #spec example_helper.rb $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__ require 'helpers/global_helper' module ExHelper include GlobalHelper def setup @browser = Watir::Browser.new @browser.add_checker lambda {|b| b.text.should_not include('The requested page could not be found.')} end # setup def collect_global_countries @countries = Array.new @countries.should be_empty @browser.goto http://www.#{$env}.com/global; @browser.table(:class, /global-list/).links.each do |link| @countries [link.text, link.href] end #links @countries.should_not be_empty def teardown @browser.close end # teardown end #module The Error: global_page_spec.rb:12: undefined method `each' for nil:NilClass (NoMethodError) from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `module_eval' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:183:in `subclass' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_methods.rb:55:in `describe' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/ example_group_factory.rb:31:in `create_example_group' from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/dsl/main.rb: 28:in `describe' from global_page_spec.rb:4 -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Jssh exception message?
Anyone knows what this exception message means? undefined method `messsage' for #JsshSocket::JSTypeError: this.docShell is null it came up on this statement: browser = Watir::Browser.new(); -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Jssh exception message?
Hi! Each time a new version of Firefox is released, the jssh extension has to be recompiled for it. You may not have the right version of the jssh extension for your version of Firefox. You can get it here: http://wiki.openqa.org/display/WTR/FireWatir+Installation Hope this helps! -Tiffany On Mar 2, 2:41 pm, hliauw hli...@gmail.com wrote: Anyone knows what this exception message means? undefined method `messsage' for #JsshSocket::JSTypeError: this.docShell is null it came up on this statement: browser = Watir::Browser.new(); -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Jssh exception message?
Tiffany, thanks. I haven't upgrade my firefox for a while. and the thing is I have other 20+ tests using firefox and they all have no problem. The only difference is that in this particular test I have require 'firewatir' statement twice. one in the test file, and another one in the watir method wrapper file. I put Timeout wrapper for all watir method that I used (was facing some reliability issue, but that's different story). Anyway, I removed the duplicate require 'firewatir' statement and that seems to fix the issue. I am not sure why that cause an issue. Shouldn't this be handled via if __FILE__ == $0 at the top of page assuming firewatir.rb has it. Anyone knows? On Mar 2, 5:11 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi! Each time a new version of Firefox is released, the jssh extension has to be recompiled for it. You may not have the right version of the jssh extension for your version of Firefox. You can get it here: http://wiki.openqa.org/display/WTR/FireWatir+Installation Hope this helps! -Tiffany On Mar 2, 2:41 pm, hliauw hli...@gmail.com wrote: Anyone knows what this exception message means? undefined method `messsage' for #JsshSocket::JSTypeError: this.docShell is null it came up on this statement: browser = Watir::Browser.new(); -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Watir Podcast #32: Brent Strange
Hi, I have just published Watir Podcast #32. Gregg and I talk with Brent Strange on his blog post Testing in 2009, a Year in Review. http://bit.ly/aklyFZ Željko -- watir.com - community manager pledgie.com/campaigns/2982 - donate to Watir watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
Re: [wtr-general] Re: Help with Watir Page Checkers
When you run those lines what happens? begin browser.add_checker PageCheckers::NAVIGATION_CHECKER browser.goto(http://www.somecrazynonexistantthing.com/reallynonexistant;) resuce= e put e end what is the value of e? marekj Watirloo: Semantic Page Objects in UseCases http://github.com/marekj/watirloo/ Support Watir Project http://pledgie.com/campaigns/2982 On Tue, Mar 2, 2010 at 10:16 AM, yoggy samuelades...@googlemail.com wrote: I have included the raise and it doesnt work still. I also removed the rescue and puts line still this doesnt work, My test stak is using Cucumber + Watir, could this be a reason ... Confused :( -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- 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: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general