Close vs Quit

The Difference

MethodWhat it closesSession after
driver.close()only the current window or tabstill alive if other windows are open
driver.quit()all windows and the driver processended; any later call fails

Using the Driver After Quit

driver.quit();
driver.getTitle();   // session is gone

Example

The second line throws:

Run QuitTest.main()

Example output

Exception in thread "main" org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '4.25.0', revision: '8a8aea2337'

Tip: Put driver.quit() in a finally block (and later in a TestNG @AfterMethod) so the browser closes even when the test fails.

WebDriver driver = new ChromeDriver();
try {
    driver.get("https://shopease.example.com");
    // test steps ...
} finally {
    driver.quit();
}