How to close the Browser window using Selenium Java

asked 1 year ago

There are two methods available to close the Browser window

Quit all the associated window and ends the Webdriver session

driver.quit();

 

Close the current Browser window alone, if there is only one window then it closes the Browser.

driver.close();

 

Navigate to https://www.qafeast.com/demo and click the Hyperlink Tab, click Web browser Automation.

If we apply driver.close(); then the current window alone will close then the other window and browser will not close. And if we apply driver.quit() then all the window and browser will be closed.