Method: Capybara::Session#switch_to_window
- Defined in:
- lib/capybara/session.rb
#switch_to_window(&block) ⇒ Capybara::Window #switch_to_window(window) ⇒ Capybara::Window
Switch to the given window.
512 513 514 515 516 517 518 519 520 521 522 |
# File 'lib/capybara/session.rb', line 512 def switch_to_window(window = nil, **, &window_locator) raise ArgumentError, '`switch_to_window` can take either a block or a window, not both' if window && window_locator raise ArgumentError, '`switch_to_window`: either window or block should be provided' if !window && !window_locator unless scopes.last.nil? raise Capybara::ScopeError, '`switch_to_window` is not supposed to be invoked from ' \ '`within` or `within_frame` blocks.' end _switch_to_window(window, **, &window_locator) end |