ruby - How to handle new browser pop up after clicking a js button in Watir? -


i trying using watir in ruby, able open browser, enter values username/password form, press enter, click submit button (actually pressing enter, easiler code), pop new browser windows our application, found have no control new browser. can do?

in addition problem, new browser window got no menubar, no toolbar, no navigation bar, cannot open ie developer toolbar find name of element in webpage in new browser.

by way, app can support ie.


i tried attach method, work:

c:/ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ie-class.rb:302:

in `attach_browser_window': unable locate window title of (?-mix:new browser title) (watir::exception::nomatchingwindowfoundexception)

    c:/ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ie-class.rb 

:150:in `_attach_init'

    c:/ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ie-class.rb 

:144:in `attach' test1.rb:36

attach method able handle new window. http://rdoc.info/gems/watir/1.8.1/watir/ie.attach

for example

 browser = watir::browser.new browser.text_field(:id,'username').set 'username') browser.button(:index,1).click # popped new window popup = watir::browser.attach(:title,'foobar') 

if use popped window, can overwrite browser variable instead.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -