Method: Selenium::WebDriver::Driver#close

Defined in:
lib/selenium/webdriver/common/driver.rb

#closeObject

Close the current window, or the browser if no windows are left.



184
185
186
187
188
189
# File 'lib/selenium/webdriver/common/driver.rb', line 184

def close
  # If no top-level browsing contexts are open after calling close,
  # it indicates that the WebDriver session is closed.
  # If the WebDriver session is closed, the BiDi session also needs to be closed.
  bridge.close.tap { |handles| @bidi&.close if handles&.empty? }
end