Let’s find the Difference in Close and Quit in Selenium web driver. In Selenium close() and quit() both methods are used to close the already opened browser instance.
Difference in Close and Quit
After executing the test case successfully, you need to close your browser instances. To close the browser we can use any of the methods.
1. close() Method – This method closes the Currently open browser window or the browser window which is in focus.
If there is more than one Browser window opened by the Selenium Automation, then the close( ) command will only close the Browser window which is having focus at that time. It won’t close the remaining Browser windows.
2. quit() Method – This method close the all open instances of the Browser. If there are more than one browser instance are opened by the Selenium and you want to close the all opened browser instances then you need to call the quit method.
If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.
close( ) and quit( ) work in the similar way when Selenium Automation opens the only single Browser window. They differ in their functionality when there are more than one Browser windows opened by the Selenium Automation.