class Capybara::Window

def current?

Returns:
  • (Boolean) - whether this window is the window in which commands are being executed
def current?
  @driver.current_window_handle == @handle
rescue @driver.no_such_window_error
  false
end