Different Between close() and quit() Functions in Selenium Webdriver

By | 15/09/2015

In Selenium, after you start a browser(by Webdriver object) you need to close it. For this purposes there are two methods. close() and quit()

What is different between them? İ see most example with close() and someone with quit(). Actually, they are almost similar and destroy web browser objects.

Only different is:

close() destroy current window/browser and quit() destroy all window/browser in session.

If you work with only one window there is not any different. If you open new window during your execution, close() function only close active page. In that case, remain window still leaves open and it cause to memory leaks

Leave a Reply

Your email address will not be published. Required fields are marked *