ruby - A child browser window closing itself apparently breaks Watir-webdriver's link to the parent window? -
in chrome, using watir-webdriver, click button opens child browser window.
i do:
@browser.window(title: 'child').use i interact various items in child window.
very shortly, there action done in window site considers "point" of opening window in first place. e.g.,
@browser.button(title: 'button').click when action performed, child window closes itself.
when tell watir-webdriver go using parent window, however, error:
@browser.window(title: 'parent').use # => results in # selenium::webdriver::error::nosuchwindowerror: emptyscript execution failed; # window not found the reason believe selenium/watir-webdriver bug because following code works:
@browser.window(title: 'child').use # ... various things in child window not # ... cause close itself. work expected. # ... puts @browser.window(title: 'parent').present? #=>true @browser.window(title: 'child').close puts @browser.window(title: 'parent').present? #=>true @browser.window(title: 'parent').use # => no error thrown the difference action causes child window close itself.
i notice watirspec code not have test case self-closing window, perhaps overlooked aspect of windows code in watir-webdriver.
okay, here code you can run, see problem yourself:
require 'watir-webdriver' @b = watir::browser.new :chrome @b.goto 'ckeditor.com/demo#full' @b.div(id: 'cke_editor1').link(title: 'link').click @b.link(title: 'browse server').wait_until_present @b.link(title: 'browse server').click @b.window(title: 'ckfinder').use { @b.frame(title: 'ckfinder').link(id: 'r0').right_click @b.frame(title: 'ckfinder').frame(id: 'cke_22_frame').wait_until_present @b.frame(title: 'ckfinder').frame(id: 'cke_22_frame').link(id: 'cke_200').click } that result in error:
selenium::webdriver::error::nosuchwindowerror: emptyscript execution failed; window not found don't never did nuthin' ya! :-)
now, before go asking "why testing 3rd party editing tool, crazy guy?" answer you: i'm not.
what i'm testing source code gets generated ckeditor tool gets updated in particular situation (which goes far beyond scope of question here). set requires first know source code is that, later, can verify gets updated different process. , that, must first set up, using ckeditor's link tool. capiche?
if need first window opened can use
@browser.windows[0] you may able (not tested)
@browser.windows.each |window| if window.title.include?(target_string) window.use end end
Comments
Post a Comment