简体   繁体   中英

Watir command to attach browser window does not work in radrails ide

I use the radrails ide for running watir tests. I have the following command:

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

Using the above command I get the error:

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>'

The Ruby version is 1.9.3, ie 8, html code of the page I want to attach -

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

after clicking on the link in the first line of code it opens new browser window.

Also today I got a new error:

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>' 

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM