Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

What is the difference between driver.close() and driver.quit() commands?

In Selenium, driver.close() and driver.quit() both close the browser windows or quit the driver instance, but there is a slight difference between the two commands.

`driver.close()`: The driver.close() method is used to close the current browser window that the driver instance controls. If there is only one browser window, this command will also quit the driver instance. Otherwise, it will close only the current window and continue to run.

`driver.quit()`: The driver.quit() method closes all the browser windows opened by the driver instance and ends the WebDriver session. This command should be used when you are done with the WebDriver instance and want to clean up the resources it uses.

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free