Skip to content

Proposal. Permit closing "first" window handle #2834

@luke-hill

Description

@luke-hill

FROM: https://github.com/teamcapybara/capybara/blame/b3325b198464b806f07ec2011ceb532d6d5cf4ab/lib/capybara/selenium/driver.rb#L235

  def close_window(handle)
    raise ArgumentError, 'Not allowed to close the primary window' if handle == window_handles.first

    within_given_window(handle) do
      browser.close
    end
  end

I propose we remove this guard. Because there seems to be plenty of legitimate reasons why you may want to close the "first" window. Especially if it's not the active one. A test may cycle through three different windows and you only want the last window

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions