Hi Jarmo,

Thanks for your post.

But, I still get the same error i.e.
"Watir::Exception::UnknownObjectException: Unable to locate element,
using :unique_number, 1" when I use:

require "watir"
b = Watir::Browser.attach :title, /title/
b.button(:unique_number, 1).click

Thanks.

Kushal

On Nov 25, 11:03 am, Jarmo Pertman <jarm...@gmail.com> wrote:
> #click_no_wait returning nil is a correct behavior. Open up the page
> in your browser where that button is and then open up an irb session
> and try this:
> require "watir"
> b = Watir::Browser.attach :title, /title/
> b.button(:unique_number, 1).click
>
> Does that do anything or does it throw the same error message as with
> #click_no_wait?
>
> If it stays blocking then open up yet another irb session (because the
> previous is unusable due to blocking) and try again to set $DEBUG=true
> and perform #click_no_wait to see the handle to the IE.
>
> Now attach again to the window and see if that hwnd matches to your
> window's hwnd:
> b = Watir::Browser.attach :title, /title/
> # verify that you have the correct window
> b.title
> b.url
>
> # now verify that the hwnd matches to the hwnd used by #click_no_wait
> b.hwnd
>
> # now try the attach command by #click_no_wait
> b = Watir::IE.attach(:hwnd, THE_HWND)
> # try to access the button
> b.button(:unique_number, 1).html
>
> Jarmo Pertman
> -----
> IT does really matter -http://www.itreallymatters.net
>
> On Nov 24, 11:50 am, Arto Vuori <vuo...@iki.fi> wrote:
>
> > Hi Kushal,
>
> > I'm having exactly the same problem and I have not found a working
> > solution.
> > I have a need to open and interact with a modal dialog. However,
> > click_no_wait simply returns nil.
>
> > -- A. Vuori
>
> > On 21 marras, 20:29, Kushal <kushal...@gmail.com> wrote:
>
> > > Hi all,
>
> > > I am stuck in this problem for three days now. I need to open a modal
> > > dialog from a button on a webpage. When I use click or
> > > fire_event("onclick"), execution just hangs. This is understandable as
> > > it waits for work to be completed on the modal dialog.
>
> > > Therefore, I am trying to useclick_no_wait, but it returns nil. I
> > > made some changes in theclick_no_waitfunction, to display the call
> > > by adding puts command on line 249 and replaced "start rubyw
> > > #{command}" with "rubyw #{command}"
>
> > > I get the following error on the console:
>
> > > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/element.rb:58:in
> > > `assert_exists': Unable to locate element, using :unique_number, 1
> > > (Watir::Exception::UnknownObjectException)
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/
> > > element.rb:263 :in `click!' from -e:1
>
> > > The command that is executed in the above call is:
>
> > > ruby -e "require 'rubygems';require 'c:/ruby/lib/ruby/gems/1.8/gems/
> > > watir-1.6.7/lib/watir/core';Watir::Button.new(Watir::IE.attach(:hwnd,
> > > 656538), :unique_number, 1).click!"
>
> > > Also, I read this article (http://jira.openqa.org/browse/WTR-144)
> > > which describes how fire_event_no_wait could be added to element.rb
> > > for fire_event("onmousedown") with no wait. However,
> > > eval_in_spawned_process method is not present in PageContainer module
> > > in Watir 1.6.7.
>
> > > Thanks.
>
> > > Kushal

-- 
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

Reply via email to