我是watir的新手,目前正在使用它来自动化应用程序,但是当我尝试点击按钮时,我遇到了一个错误。
Watir代码如下所示:
$browser.button(:id,"Button_one").click
html for button看起来像这样:
<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'
按钮似乎不可见,禁用。这可能是导致此错误的原因?请告诉我如何解决这个问题....
答案 0 :(得分:1)
试试这个:
$browser.button(:id => "Button_one").when_present.click