As on my code I'm trying to find an element and click on it.
If the element is not available then there will be an exception.
So inside the exception I'm trying to close the web driver.
But as on the image when I say driver.Quit();
it's not quitting as the driver is in an exception.
So is there any other way to close the driver and start it again when something like this happens.
I tried with killing the process names contain "web driver","chrome driver" text. But that didt work well too.
try
{
driver.Navigate().GoToUrl("https://www.appreviewguru.com/");
Thread.Sleep(9000);
driver.FindElement(By.Id("mainnbt")).Click();
Thread.Sleep(9000);
DateTime now2 = DateTime.Now;
File.AppendAllText(@"C:\driver\aaa.txt", proxies[i] + now2.ToString() + Environment.NewLine);
driver.Close();
}
catch (Exception e)
{
// driver.Close();
driver.Quit();
}