I am not sure what is going on but I am getting a org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started error. This just suddenly started happening. I made no code changes or updates.The server just started to time out one day.
Android 14
iOS 17
Mac Sonoma 14
Appium 2.2.1
uiautomator2 2.34.1
xcuitest 5.8.2
java 11
node 21.1.0
appium_server_log_iOS.log (621.2 KB)
appium_server_log_Android.log (865.8 KB)
Looking at the logs it seems that the time between appium commands keeps getting longer. Almost seems like it is freezing up then the newCommandTimeout is reached and the session in terminated. I have newCommandTimeout set to 3 minutes and have tried setting it to 10 minutes with the same result.
I am using java 11 and Cucumber TestNG to run my automation tests on real Android and iOS devices. I am locating the app elements using PageFactory and AppiumFieldDecorators. A quick example code is
public class AppPage{
public AppPage(AppiumDriver driver){
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(15L)), this);
}
@iOSXCUITFindBy(accessibility = "Welcome")
@AndroidFindBy(accessibility = "Welcome")
private WebElement welcomeTxt;
public bolean isPageOpen(){
return welcomeTxt.isDisplayed();
}
}
Even the simple WebElement.isDisplayed() method will sometimes just never reach the appium server and it will just sit silent until it times out.
I have tried adding both implicit and explicit waits but eventually the times between commands just exceeds the newCommandTimeout. Even scenarios that identical except for the users will take longer and longer to execute as the test run progresses.