What is the difference between driver.close() and driver.quit() commands?
Watch the answer for this Selenium Interview Question in a detailed manner in the below youtube video:
Note: Don’t forget to subscribe to my Youtube channel here: Click here
Notes used for explanation in this Youtube video are provided after the video:
Notes used in the above Youtube Video:
The following is the difference between driver.close() and driver.quit() commands in Selenium WebDriver:
- > driver.close() command will only close the browser window which is in focus, out of all the windows opened
- > If the current focus is on the main/defect window, driver.close() will close the main/default window
- > If you have switched to a popup window or new tab window from the main/default window, driver.close() will close the current focused child window
- > driver.quit() command will close all the browser windows which are opened irrespective of their count (including the default and child windows)
- > For more Selenium Interview Questions and answers, continue to the next post (Click on Next Post link below)
- > Check complete Selenium Interview Questions list here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?