1

我是 watir 的新手,目前正在使用它来自动化应用程序,但是当我尝试单击一个按钮时,我遇到了一个错误。

Watir 代码如下所示:

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

按钮的 html 如下所示:

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

显示的错误是:

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'

按钮似乎不可见,已禁用。此错误的原因可能是什么?请让我知道如何处理这个....

4

1 回答 1

1

尝试这个:

$browser.button(:id => "Button_one").when_present.click 
于 2012-08-20T19:39:18.250 回答