Watir : Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus

1

I'm new to watir and currently using it for automating an application , however I'm stuck at one error when I try click a button.

Watir code looks like this :

$browser.button(:id,"Button_one").click 

html for button looks like this:

<input id="Button_one" class="ButtonA ButtonB" type="submit" value="Continue">.

error displayed is:

WIN32OLERuntimeError: (in OLE method `focus': )
    OLE error code:800A083E in htmlfile
      Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
    HRESULT error code:0x80020009
      Exception occurred.
    Ruby192/lib/--/input_elements.rb:294:in `method_missing'
    Ruby192/lib/--/watir-classic/input_elements.rb:294:in `set'

Button does not seem to be invisible, disabled.What can be the reason for this error?? pls let me know how to deal with this ....

ruby-on-rails
ruby
ruby-on-rails-3
selenium-webdriver
watir
asked on Stack Overflow Aug 20, 2012 by Mandy

1 Answer

1

Try this:

$browser.button(:id => "Button_one").when_present.click 
answered on Stack Overflow Aug 20, 2012 by Ċ½eljko Filipin

User contributions licensed under CC BY-SA 3.0