Closing Browser properly in Selenium

Here is the code that would enable you to properly kill the browser in Selenium and also it’s driver

I use this code because it closes the Browser and kills it properly when compared with the code Driver.Close()

 

//Checking whether Driver is not Null
if (Driver != null)
{
       //Quitting the Driver and setting it Null
       Driver.Quit();
       Driver = null;
                 
  }

 

You may also like...