sajagkarki / MorePractice

0 stars 0 forks source link

What is the difference between Driver.Quit Driver.Close? #8

Open sajagkarki opened 1 year ago

sajagkarki commented 1 year ago

Driver.Close . It closes the instance of the current browser. Driver. Quit.

In Selenium, both close() and quit() methods are used to close the browser. However, there is a difference between them. The close() method closes only the current browser window and quits the driver only if no other windows are left. On the other hand, the quit() method quits the driver and closes all browser windows associated with that session123.

To sum things up, use close() method for closing pop-up windows or temporary tabs, and use quit() method for ending the session when the test case is completed and you no longer need the driver instance1.