I'm using Microsoft Test Framework - MST. I'd like to close the browser after the test is run. So I added a CleanUp method.
[TestCleanup]
public void CleanUp()
{
page.Exit();
}
This is how the Exit() method is defined.
public void Exit(int seconds = 3)
{
if (driver != null)
driver.Quit();
}
That works for one unit test. However, when I run all the tests at once, I'm getting an exception because the framework keeps using the same driver. When the driver is destroyed, the framework is still counting on the driver that's just been destroyed.
Is it possible to decide when to destroy the webdriver instance? I mean, when I running only one test, the driver should be destroyed at end of that one test. And, when I'm running more than one, the driver should be destroyed at the of the last test. Maybe that means deciding when to call the CleanUp method. I don't know.
Thanks for helping.
Aucun commentaire:
Enregistrer un commentaire