Latest Posts

Difference between driver.close() and driver.quit()

The difference between close() and quit() function is as follows:

close() function closes the current tab on which the control of web-driver is present. It will not close other tabs of the browse.

quit() function closes the complete browser that is opened by web-driver.




package demopackage; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class TestClass { public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver();

1 comment:

  1. Ahh so close() just kills the current tab but quit() shuts the whole browser, kinda handy to know when you’re juggling multiple windows. Makes test scripts way cleaner. Also if anyone looking for quick results check kolkata ff for updates.

    ReplyDelete