附加浏览器窗口的Watir命令在radrails ide中不起作用

时间:2012-06-07 10:48:50

标签: watir title radrails

我使用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>' 

2 个答案:

答案 0 :(得分:1)

好吧,错误消息说明了所有内容:Unable to locate a window with title of Task

答案 1 :(得分:1)

要解决此问题,请使用Watir Web Driver。