.

Appium : Session ID is null. Using WebDriver after calling quit()?

 

ERROR 

Exception org.openqa.selenium.remote.SessionNotFoundException

Message: Session ID is null. Using WebDriver after calling quit()?

In my case, I instantiate driver in beforemethod and quit in aftermethod. And I kept appium setting to Full Reset.

The issue is that when I run multiple test cases, it skips few of them and the count of skipped test cases is not same always.

 On digging it further, I found that simulator crashes in beforemethod while instantiating.




Solution

1.  This happens when appium fails to launch instruments while launching. Go to Appium > iOS settings and tick Backend-retries and increase the retry count to let's say 10.





2.  If this down't work then set configfailurepolicy flag in testng xml to "continue". It won't skip the test cases in case of exception in beforemethod.

     <suit name="MeGettingError Test Suite"  configfailurepolicy="continue" >
 
 
3.  You can also try retry logic in this way:
 
 
for (int i = 10; i > 0; i--) {
        try {
            driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            i = 0;
        } catch (UnreachableBrowserException e) {
            LOGGER.info("Waiting for Appium to start");
        }
    }

Recent Posts