I have implement two scenario outlines in one feature file at cucumber, and also wrote script that new browser initiate in @After
Junit command when my test case fail.
@After
public void teardownpatientregis(Scenario s) throws IOException, InterruptedException
{
if(s.isFailed())
{
Screenshots.getscreenshot(s);
driver.quit();
initialize(failbrowser);
url(failurl);
Logintestpage.getusername(failuser);
Logintestpage.getpassword(failpass);
Logintestpage.loginalert();
Thread.sleep(2000);
Logintestpage.logout();
driver.quit();
}
}
But the new Webdriver does not initiate after close my browser. It shows SessionNotCreatedException errors. Please help me to resolve this issue