Finally, I found what the issue was. It is happening because I am using IE.attach to attach to the page instead of using browser.Start or browser.goto. With browser.goto things started working fine.
Apparently the error message that was logged by the $DEBUG= true itself helped me. I saw that internally there is again a call to do an IE.attach, and I guessed that may be failing. Please see the relevant part of the error message below: Watir::Button.new(Watir::IE.attach(:hwnd, 591236), :unique_number, 4).click!();" On Jun 2, 1:50 pm, Babitha <[email protected]> wrote: > Trust me. I have done my research. I know there were already many > issues reported with element.click_no_wait and most of them are > supposed to be fixed. But, I still have this problem with the latest > version of watir. > > I am pretty sure with the same version of ruby it worked for me in > another system, but as far as I can remember the watir version was an > earlier one. > > My current ruby version is 1.86-26 p(111), watir -1.8.1 > OS: Windows 7, IE 8. > > Here is the problem. > > I have a button on my page, clicking on which it displays a javascript > confirmation dialog. I tried it with click() function, and it works > fine. But, with click_no_wait() nothing happens, and the control just > passes on to the next statement. > Below is my code: > > $b = Watir::IE.attach(:url, "myurl") > sleep(2) > > btn = $b.button(:id, "btnClear") > $DEBUG = true > btn.click_no_wait() > $DEBUG=false > > My page does not use frames. > > As was suggested in some earlier questions, I put $DEBUG=true and > $DEBUG=false statements around the click_no_wait call and below is > what I got. > > #no_wait command: > Exception `WIN32OLERuntimeError' at c:/ruby/lib/ruby/gems/1.8/gems/ > watir-1.8.1/lib/watir/element.rb:208 - > ruby -e "$:.unshift('c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/ > watir/win32ole').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > commonwatir-1.8.1/lib').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > firewatir-1.8.1/lib').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > watir-1.8.1/lib');require 'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/ > lib/watir/core';Watir::Button.new(Watir::IE.attach(:hwnd, > 591236), :unique_number, 4).click!();" > OLE error code:0 in <Unknown> > <No Description> > HRESULT error code:0x80070057 > The parameter is incorrect. > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/element.rb:58:in > `assert_exists': Unable to locate element, using :unique_number, 4 > (Watir::Exception::UnknownObjectException) > from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ > element.rb:275:in `click!' > from -e:1 > > I have gone > throughhttp://jira.openqa.org/browse/WTR-320andhttp://jira.openqa.org/browse/WTR-459. > > Can somebody please help me with this? > Thanks, > Babitha -- 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]
