Invalid Session ID Error message coming while execution automation scripts in Appium Studio 10.9.82

Hi ,

I am repeatedly getting Invalid Session ID Error message while executing the existing automation scripts in Appium Studio 10.9.82. I was not facing this issue while executing the same existing automation scripts in Appium Studio 10.8.41 . Can you please let us know why this kind of error exception is comming in new Appium Studio 10.9.82 repeatedly.
I am executing the automation scripts for IOS and Android Native apps.

ERROR EXCEPTION MESSAGE:

org.openqa.selenium.remote.SessionNotFoundException: invalid session id (Invalid session ID) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 69 milliseconds
Build info: version: ‘2.53.1’, revision: ‘a36b8b1cd5757287168e54b817830adce9b0158d’, time: ‘2016-06-30 19:26:09’
System info: host: ‘XXXXXX’, ip: ‘XXXXXX’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_131’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{device.majorVersion=10.x, dontGoHomeOnQuit=false, device.os=iOS, noReset=true, dontStopAppOnReset=false, reservationDuration=240, fullReset=false, platform=ANY, device.serialNumber=XXXXX, device.version=10.3.1, deviceQuery=@os=‘ios’, automationName=XCUITest, autoWebview=false, enableClientLog=false, platformName=iOS, device.screenSize=1242x2208, testName=Untitled, device.screen=Large, device.manufacture=Apple, instrumentApp=false, bundleId=XXXXXXX, keepKeyChains=false, waitForDeviceTimeout=120000, device.model=iPhone 6+, device.name=iPhone, projectName=}]
Session ID: b6ba1753-7d2f-4fbb-aef4-e32c789c729e

maybe replacing the jar files of your project with newer ones included in 10.9.82?

Hi Mate,

Already replaced the updated new jars of 10.9.82 in the project before execution. There will be some other issue.

Thanks.

@shubu7488

Can you please share with us the automation scripts?

The error appears at the beginning of the test or while it’s running? Sometimes the SessionID get lost if passes a lot of time between test steps (i.e. debugging and going step by step manually)

This Invalid Session ID Error message comes in middle of the debug execution while debbugging the scripts step by step. But this should be handled by the JARS. As earlier it was working fine wile degugging code in 10.8.41 appium studio version.

Same “issue” appears with SeetestAutomation, if you take a long time between steps while debugging the Agent disconnects from the device (the sessionID turns invalid).

Not really an issue, I think it’s a kind of timeout that the agent had between actions. Maybe someone from Experitest could explain it better.

When moving from 10.8 to 10.9, you cannot use the SeeTestAndroidDriver, but you need to use AndroidDriver that is part of Appium open source client (the same is true for iOS driver).
The port that you should use is not 8889 but 4723.

By changing both things you should be able to run tests.

Hi guy,

Ya , the required changes for AnroidDriver & IOSdriver are done by replacing SeeTestAndroidDriver & SeeTestIOSDriver along with the host and port number were done earlier after upgrading to Appium studio 10.9. Still we are facing the Invalid Session ID exception while we are debugging the code for long time, by which we raised this issue in community.

But now as Appium studio is using directly Android Driver & IOSdriver of Appium so during our debugging of code line by line for time the appium driver session is getting timed out with the mobile device interaction for which INVALID SESSION ID exception is coming.

For this I got a solution which i was earlier using for APPIUM as setting the NEW_COMMAND_TIMEOUT capabilities mentioned below,

dc.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 300);

Hi Guy,

I’m using C# with Appium Studio 10.9.82, with “newCommandTimeout” capability as 3600, but still in the middle of test execution am getting exception : {"invalid session id (Invalid session ID) "}, even though it doesn’t reach max of given newCommandTimeout

P.S. I’ve not made any modification with my C# test, except - instead of using starting standard Appium server, I’ve started Appium Studio and Initialized Android driver as mentioned below.

Could you please help us with this. We couldn’t proceed further

Code Snippet:
AndroidDriver driver;
DesiredCapabilities capability = new DesiredCapabilities();

capability.SetCapability(“newCommandTimeout”, Constants.Paths.newCommandTimeout);
capability.SetCapability(“deviceName”, Constants.DeviceName);
capability.SetCapability(“platformName”, Constants.PlatformName);
capability.SetCapability(“platformVersion”, Constants.PlatformVersion);
capability.SetCapability(“automationName”, Constants.AutomationName);
capability.SetCapability(“appPackage”, Constants.PackageName);
capability.SetCapability(“fullReset”, false);
capability.SetCapability(“noReset”, true);
capability.SetCapability(“autoWebviewTimeout”, 180000);
capability.SetCapability(“unicodeKeyboard”, true);
capability.SetCapability(“nativeWebScreenshot”, true);
capability.SetCapability(“app”, Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.Parent.FullName + “/sdk/apk/” + Constants.AppName + “.apk”);
capability.SetCapability(“appActivity”, Constants.Activities.AcceptandLaunchActivityName);

TimeSpan timeSpan = TimeSpan.FromMinutes(20);
driver = new AndroidDriver(new Uri(“http://localhost:” + port + “/wd/hub”), capability, timeSpan);

Thanks,
Saravanan