Other important points

You will notice that in the tearDown(), we call quit().We call quit() because this call cleans up all of the resources that WebDriver starts up and uses. If you were to call close(), it will only close the window that Selenium WebDriver is currently on. On some implementations of the server-side, or browser code, when we use close() method and it is the last window open, then the server-side code will act as though quit() was called.

Get Learning Selenium Testing Tools - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.