selenium webdriver

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


The new Webdriver does not initiate after closing the browser because you are NOT closing the browser, you are issuing a quit instead.

Replace at least the first driver.quit() with driver.close() if not both of them.

链接地址: http://www.djcxy.com/p/52336.html

上一篇: 使用OpenXML SDK在Excel电子表格中创建单元格注释

下一篇: 硒webdriver