The difference between quit() and close()

Two very important methods available in the WebDriver interface are quit() and close(). For beginners in Selenium, this is a topic of confusion because of a lack of understanding of its usage. Let's next understand both these methods, using these distinctions:

  • driver.quit(): The quit() method quits the driver, closing every associated window.
  • driver.close(): The close() method closes the currently focused window, quitting the driver if the current window is the only open window. If there are no windows open, it will error out.

We will be looking in detail at these two methods when we learn about handling popups.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.39.55