[wtr-general] wait_until_enabled ?
Hi all, Having migrated to WATIR 2.0.1 from a really old 1.6.2 version, I'm now in the process of updating all my tests. All was going very well until I got to changing an old command that waits until a button is enabled. Here's what I used on my old Ruby1.8.6/Watir1.6.2 environment: Watir::Waiter::wait_until { browser.button(:id, "btnFoo").enabled? } ... and (wrongly) assumed in my Watir2.0.1 environment that the new wait_until method would work something like: browser.button(:id, btnFoo").wait_until_enabled Does anyone have any suggestions on how to wait until a button becomes enabled? The button in question is always present; but only becomes enabled (and ultimately selectable) after changing a parameter. Thanks, GJHmf -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Opening a HTML file in the browser window
Hi guys, I'll first explain what the test is to make it easier to understand. I have a very basic HTML file which has a button that simulates a post request and loads a page when clicked. In my env.rb I have the following code: def start_browser @browser = Watir::Browser.new(:firefox, {:port => PORT}) # @browser = Watir::Browser.new(:firefox, {:profile => 'default',:port => PORT}) end Before do start_browser end After do @browser.close end When I run the test the above code opens a blank browser instance which I expected, I can also open the HTML file in a separate browser however when I try to interact with the elements in the HTML file I cant seem to switch the focus. I have tried @browser.window(:title, ' ').use Has anyone got any ideas?? Thanks in advance Mo -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Getting errro in Chrome. Please suggest answer.
Does any one know how to resolve this problem? Please tell me know. Thanks in advance. On Sat, Aug 20, 2011 at 3:50 PM, Amit Bobade wrote: > Dear All: > > I am trying to run the script from HTML and the script is getting run > successfully in FF. > > But it is showing error while running in Chrome. I am getting following > error: > > * > > Started ChromeDriver > port=1689 > .\test\automation\proxy_launcher.cc(124): error: Value of: app_launched > Actual: 1 > Expected: AUTOMATION_SUCCESS > Which is: 0 > Error while awaiting automation ping from browser process > > .\test\automation\proxy_launcher.cc(259): error: Value of: > automation()->GetBrowserWindowCount(&window_count) > Actual: false > Expected: true > > * > *I am using Ruby187 and Watir Webdrivers. > > *Please tell me how to resolve this error. > > > -- > Thanks and Regards, > Amit > > -- Thanks and Regards, Amit -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Ang.: Re: Object no longer attached to the DOM error on doing a exists call
Ok, so we are trying to do an exist? call on an element that is shown after clicking a button, which executes some javascript, but it seems like it still is failing for us with this new update to watir-webdriver (it's calling the DOM error in our script). As it is intermittent, perhaps it's more of a timing issue? (as in the script is running before the jquery). Wait_until doesn't really work, but a sleep will do, but as this is bad practice, I would rather see this fixed some other way. Any suggestion here guys? When /^I am selecting (.+) period$/ do |cool_off| on AccountCoolOff do |page| page.cool_off_period_select_value= cool_off page.confrim_cool_off sleep 5 end end Then /^I should see Account Cool Off (\d+) date$/ do |cool_off_date| on AccountCoolOff do |page| wait_until{page.cool_off_submit_link.exists?} @current_date = ((Date.today + cool_off_date.to_i).day).to_s wait_until{@browser.text.include? @current_date} page.cool_off_submit end end -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Could not find win32-api error when running script after installing latest WATIR 2.0
Check the version of win32-api that is installed. The error message is indicating that: Could not find win32-api (>= 1.3.0) >From a Windows command window type: gem list Does the list include a version greater than 1.3.0? If it isn't listed, install the current gem gem install win32-api I believe the current version of win32-api is: 1.4.8 On Aug 19, 12:40 pm, solyanka wrote: > I installed Ruby 1.8.7 and Watir 2.0 , then tried to run my testcase > and it failed giving error: > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in > `to_specs': Could not find win32-api (>= 1.3.0) amongst > [activesupport-2.3.2, builder-2.1.2, commonwatir-2.0.1, > commonwatir-1.6.5, commonwatir-1.6.2, ffi-1.0.9-x86-mingw32, > firewatir-1.6.5, firewatir-1.6.2, fxri-0.3.6, fxruby-1.6.16-x86- > mswin32-60, hoe-1.12.2, hpricot-0.6.164-x86-mswin32, json_pure-1.2.0, > log4r-1.0.5, nokogiri-1.4.0-x86-mswin32, ptools-1.1.6, rake-0.8.7, > rake-0.8.1, rautomation-0.6.3, require_all-1.1.0, ruby-opengl-0.60.0- > x86-mswin32, rubyforge-2.0.3, rubyforge-1.0.3, rubygems-update-1.8.8, > rubygems-update-1.3.5, rubygems-update-1.3.4, s4t-utils-1.0.4, test- > unit-2.0.1, user-choices-1.1.6, watir-2.0.1, watir-1.6.5, watir-1.6.2, > win32-api-1.4.5-x86-mswin32-60, win32-api-1.4.2-x86-mswin32-60, win32- > api-1.2.1-x86-mswin32-60, win32-api-1.2.0-x86-mswin32-60, win32- > clipboard-0.4.4, win32-dir-0.3.2, win32-eventlog-0.5.0, win32- > file-0.5.5, win32-file-stat-1.3.1, win32-process-0.5.9, win32- > sapi-0.1.4, win32-sound-0.4.1, windows-api-0.3.0, windows-api-0.2.4, > windows-pr-1.2.0, windows-pr-1.0.5, xml-simple-1.0.12] > (Gem::LoadError) > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > `traverse' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > `each' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > `traverse' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1934:in > `traverse' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > `each' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > `traverse' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > `each' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > `traverse' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:465:in > `find_in_unresolved_tree' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:463:in > `reverse_each' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:463:in > `find_in_unresolved_tree' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:47:in > `require' > from C:/WATIR2/API/DEVICES/RECIVA/cases.rb:2 > > cases.rb: > require 'watir' > require 'test/unit' > require 'watir/testcase' > require 'test/unit/testsuite' > require 'test/unit/ui/console/testrunner' > require "dbi" > require "win32ole" > require 'C:/WATIR2/Cookies' > require 'C:/WATIR2/conf' > require 'require_all' > require_all 'C:/WATIR2/API/DEVICES/LIB/*.rb' > require 'watir/contrib/Xls' > > Please help, > Thank You, > Lana -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re : Re: Re : Re: Re : Watir is slow with nested frames
I am back from my hollidays and back to this performance problem. I used a debugger (Eclipse) and the profiler (require 'profile') and found out that the problem comes from the method assert_exists of the class Element (in element.rb): def assert_exists locate if respond_to?(:locate) unless ole_object raise UnknownObjectException.new( Watir::Exception.message_for_unable_to_locate(@how, @what)) end The problem is that this method is called again and again by many methods, also by those called by assert_exists! As a result, for my simple example of 7 nested frames, this method was called 1536 times! The same elements were located again and again with exactly the same criteria (@how, @what and @container)! I modified the method assert_exists by adding four class variables that store the three location criteria and the OLE object found. Next time when the method assert_exists is called, the new criteria are compared with the previous ones. If they are the same, no need to 'locate' again, simply return the object found previously. After my modification, the method assert_exists is called only 17 times (always with my simple example), and the real location is done only 8 times (7 frames and one text field) - other 9 calls return the previously located objects. And everything takes less than 1 second (compared to 15 seconds before!). Here is the modified method: def assert_exists if respond_to?(:locate) if (defined?(@@how) && defined?(@@what) && defined?(@@container) && defined?(@@o) && @@how == @how && @@what == @what && @@container == @container) # The element has already been located -> take the already located OLE object @o = @@o else # Locate the element... locate # ...and save the information that served to locate it... @@how = @how @@what = @what @@container = @container # ...and also the located OLE object. @@o = @o end end unless ole_object raise UnknownObjectException.new( Watir::Exception.message_for_unable_to_locate(@how, @what)) end end Question: As I am new to Watir (and Ruby), maybe I have ommited an important functionnality that may be broken by my modification. Is my modification safe? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: should exist in a case statement
You will have better luck with support in the RSpec group, and honestly, but reading the RSpec manual/FAQ. You're confusing RSpec conventions with WATIR and mixing the two. http://old.nabble.com/rspec-users-f17460.html http://rspec.rubyforge.org/rspec/1.2.7/ On Aug 19, 10:23 am, Rahul Sharma wrote: > Any suggestion on this folks? > > On 18 August 2011 15:29, Rahul Sharma wrote: > > > > > > > > > > > ok. I also tried moving require 'rspec' to the environment file from > > the other file which I load after env.rb but that didn't help either. > > > On Aug 18, 2:31 pm, Rahul Sharma wrote: > > > Hi Guys, > > > > Just wondering what happens behind the scenes in case of should exist? > > > > I am trying to do the following: > > > > Class DepositSuccess > > > > def initialize(browser) > > > @browser = browser > > > verify_page_is_displayed > > > end > > > > def verify_page_is_displayed > > > case SITE_NAME > > > when /abc/ > > > messageA.should exist > > > when /def/ > > > messageB.should exist > > > end # end case > > > end > > > > end # class > > > > when i replace should exist with exists? it works. I agree I should > > > not be asserting anything in the method but this is odd one out. > > > The error I get is the following: > > > > undefined local variable or method `exist' for # > > 0x103d7fc18> (NameError) > > > -- > > Before posting, please readhttp://watir.com/support. In short: search > > before you ask, be nice. > > > watir-general@googlegroups.com > >http://groups.google.com/group/watir-general > > watir-general+unsubscr...@googlegroups.com > > -- > Regards, > > Rahul Sharma > Ph:+44 7800 736851 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Could not find win32-api error when running script after installing latest WATIR 2.0
Thank You, Installing gem did it. On Aug 22, 5:57 am, joedio wrote: > Check the version ofwin32-apithat is installed. > The error message is indicating that: > Couldnotfindwin32-api(>= 1.3.0) > > From a Windows command window type: > gem list > > Does the list include a version greater than 1.3.0? > > If it isn't listed, install the current gem > gem installwin32-api > > I believe the current version ofwin32-apiis: 1.4.8 > > On Aug 19, 12:40 pm, solyanka wrote: > > > > > > > > > I installed Ruby 1.8.7 and Watir 2.0 , then tried to run my testcase > > and it failed giving error: > > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in > > `to_specs':Couldnotfindwin32-api(>= 1.3.0) amongst > > [activesupport-2.3.2, builder-2.1.2, commonwatir-2.0.1, > > commonwatir-1.6.5, commonwatir-1.6.2, ffi-1.0.9-x86-mingw32, > > firewatir-1.6.5, firewatir-1.6.2, fxri-0.3.6, fxruby-1.6.16-x86- > > mswin32-60, hoe-1.12.2, hpricot-0.6.164-x86-mswin32, json_pure-1.2.0, > > log4r-1.0.5, nokogiri-1.4.0-x86-mswin32, ptools-1.1.6, rake-0.8.7, > > rake-0.8.1, rautomation-0.6.3, require_all-1.1.0, ruby-opengl-0.60.0- > > x86-mswin32, rubyforge-2.0.3, rubyforge-1.0.3, rubygems-update-1.8.8, > > rubygems-update-1.3.5, rubygems-update-1.3.4, s4t-utils-1.0.4, test- > > unit-2.0.1, user-choices-1.1.6, watir-2.0.1, watir-1.6.5, watir-1.6.2, > >win32-api-1.4.5-x86-mswin32-60,win32-api-1.4.2-x86-mswin32-60,win32-> > >api-1.2.1-x86-mswin32-60,win32-api-1.2.0-x86-mswin32-60, win32- > > clipboard-0.4.4, win32-dir-0.3.2, win32-eventlog-0.5.0, win32- > > file-0.5.5, win32-file-stat-1.3.1, win32-process-0.5.9, win32- > > sapi-0.1.4, win32-sound-0.4.1, windows-api-0.3.0, windows-api-0.2.4, > > windows-pr-1.2.0, windows-pr-1.0.5, xml-simple-1.0.12] > > (Gem::LoadError) > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > > `traverse' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > > `each' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > > `traverse' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1934:in > > `traverse' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > > `each' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1932:in > > `traverse' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > > `each' > > from > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1931:in > > `traverse' > > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:465:in > > `find_in_unresolved_tree' > > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:463:in > > `reverse_each' > > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:463:in > > `find_in_unresolved_tree' > > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:47:in > > `require' > > from C:/WATIR2/API/DEVICES/RECIVA/cases.rb:2 > > > cases.rb: > > require 'watir' > > require 'test/unit' > > require 'watir/testcase' > > require 'test/unit/testsuite' > > require 'test/unit/ui/console/testrunner' > > require "dbi" > > require "win32ole" > > require 'C:/WATIR2/Cookies' > > require 'C:/WATIR2/conf' > > require 'require_all' > > require_all 'C:/WATIR2/API/DEVICES/LIB/*.rb' > > require 'watir/contrib/Xls' > > > Please help, > > Thank You, > > Lana -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Ang.: Re: Object no longer attached to the DOM error on doing a exists call
Did you switch back the behaviour to see if it works? Can you provide some sample HTML/JavaScript code? Watir::always_locate = false b = Watir::Browser.new -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: wait_until_enabled ?
Does this work? Watir::Wait.until { browser.button(:id, "btnFoo").enabled? } -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Watir support for Ruby 1.9.2?
Hi, Does Watir 2.0.1+ support Ruby 1.9.2? Just updating watir.com and would like to know. Cheers, Alister -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir support for Ruby 1.9.2?
To answer my own question, I don't think it does. Using a .set on a text_field throws: irb(main):011:0> b.text_field(:name => "q").set "s" NoMethodError: unknown property or method: `createEvent' HRESULT error code:0x80020006 Unknown name. from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in `method_missing' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in `create_event' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:343:in `dispatch_event' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/input_elements.rb:376:in `set' from (irb):11 from C:/Ruby192/bin/irb:12:in `' -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Watir support for Ruby 1.9.2?
I thought the last email about 2.0.1 was that it was compatible with 1.9.2 and more like watir-webdriver On Mon, Aug 22, 2011 at 10:02 PM, Alister Scott wrote: > To answer my own question, I don't think it does. Using a .set on a > text_field throws: > > > irb(main):011:0> b.text_field(:name => "q").set "s" > NoMethodError: unknown property or method: `createEvent' > HRESULT error code:0x80020006 > Unknown name. > from > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in > `method_missing' > from > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in > `create_event' > from > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:343:in > `dispatch_event' > from > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/input_elements.rb:376:in > `set' > from (irb):11 > from C:/Ruby192/bin/irb:12:in `' > > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > watir-general@googlegroups.com > http://groups.google.com/group/watir-general > watir-general+unsubscr...@googlegroups.com > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir 2.0.1 Released
I can't get locating elements to work on 1.9.2: irb(main):012:0> b.text_field(:name, "q").set "s" NoMethodError: unknown property or method: `createEvent' HRESULT error code:0x80020006 Unknown name. from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in `method_missing' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:377:in `create_event' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/element.rb:343:in `dispatch_event' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.1/lib/watir/input_elements.rb:376:in `set' from (irb):12 from C:/Ruby192/bin/irb:12:in `' -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: It is possible to have watir-webdriver and selenium-webdriver (ruby bindings) in the same script ?
What exactly are you trying to do with both drivers. It works for me (see code below) but I can't understand why you'd want to. ruby-1.9.2-p290 :003 > require "watir-webdriver" => true ruby-1.9.2-p290 :004 > b = Watir::Browser.new => # ruby-1.9.2-p290 :005 > b.goto "www.google.com" => "http://www.google.com.au/"; ruby-1.9.2-p290 :006 > b.driver.find_element(:name, 'q').send_keys "hello" => "" ruby-1.9.2-p290 :007 > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com