0

我使用 radrails ide 来运行 watir 测试。我有以下命令:

ie.link(:text, "Task").click
ie1=Watir::IE.attach(:title, 'Task')

使用上面的命令我得到错误:

E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:760:in `rescue in attach_browser_window': Unable to locate a window with title of Task (Watir::Exception::NoMatchingWindowFoundException)
    from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:755:in `attach_browser_window'
    from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:157:in `_attach_init'
    from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:151:in `attach'
    from file.rb:31:in `<main>'

Ruby版本是1.9.3,即8,我要附加的页面的html代码-

<a id="sdmenu141" class="nodeSel" onclick="javascript: dmenu.s(141);" target="_self" href="javascript:configuredWindowOpen('../ROU/Mterou004p0001Form.do?resetFilter_‌​‌​action=','_blank','regular');">Task</a>

单击第一行代码中的链接后,它会打开新的浏览器窗口。

今天我也遇到了一个新错误:

E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-cla‌​ss.rb:374:in method_missing': (in OLE method navigate': ) 
(WIN32OLERuntimeError) OLE error code:800700AA in <Unknown> <No Description> HRESULT error code:0x80020009
Exception occurred. from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-cla‌​ss.rb:374:in goto' from file.rb:7:in <main>' 
4

2 回答 2

1

要解决此问题,请使用 Watir Web 驱动程序。

于 2012-06-08T10:25:56.980 回答
1

好吧,错误消息说明了一切:Unable to locate a window with title of Task

于 2012-06-08T07:43:12.973 回答