Is there a way to increase session time?


#1

As --command–timeout is deprecated in appium 1.5. Is there any work around for the session to never end/ to improve session time.
newCommandTimeout is not working properly, through i am giving 3000 its ending the session in a minute.


#2

You can specify a JSON string for default capabilities starting with 1.5.

appium --default-capabilities '{"newCommandTimeout": 3000}'

I would say to double-check your code to make sure you’re not calling any method that can end the session early, e.g. driver.quit.

What are your Appium logs?


#3

When i used appium --default-capabilities ‘{“newCommandTimeout”: 3000}’ the session didnt end,
here are my previous logs without using default-capabilities

[Appium] New IosDriver session created successfully, session 924857e0-9461-46fe-b203-86d164d2bf4b added to master session list
[MJSONWP] Responding to client with driver.createSession() result: {“webStorageEnabled”:false,…
[HTTP] <-- POST /wd/hub/session 200 13594 ms - 571
[BaseDriver] Shutting down because we waited 60 seconds for a command
[debug] [iOS] Deleting ios session
[debug] [UIAuto] Destroying instruments client socket.
[debug] [UIAuto] Closing socket server.
[Appium] Closing session, cause was ‘New Command Timeout of 60 seconds expired. Try customizing the timeout using the ‘newCommandTimeout’ desired capability’
[Appium] Removing session 924857e0-9461-46fe-b203-86d164d2bf4b from our master session list
[debug] [UIAuto] Instruments socket server was closed
[debug] [Instruments] Starting shutdown.
[debug] [Instruments] Sending sigterm to instruments
[debug] [Instruments] [INST] 2016-07-21 20:29:01 +0000 Stopped: Script was stopped by the user
[debug] [Instruments] [INST STDERR] 2016-07-21 16:29:02.001 instruments[24623:652638] Attempting to set event horizon when core is not engaged, request ignored
[debug] [Instruments] [INST STDERR] 2016-07-21 16:29:02.002 instruments[24623:652401] Attempting to set event horizon when core is not engaged, request ignored
[debug] [Instruments] [INST] Instruments Trace Complete (Duration : 70.930946s; Output : /var/folders/32/l_wsl1rd6wj700vcwhxc1c3wc_dbl6/T/appium-instruments/instrumentscli0.trace)
[debug] [Instruments] Instruments exited with code 0
[debug] [iOSLog] Stopping iOS log capture
[debug] [iOS] Running ios real device reset flow


#4

So… does this mean this option resolves your issue? This definitely sounds like it extends your session like you wanted.


#5

Absolutely inserting the UDID and the port. Yes


#6

You can also set it as capability when creating driver as

DesiredCapabilities capabilities = new DesiredCapabilities();
...
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, Constants.TIMEOUT);
...

#7

Hello Telmo,

wat is the import statement for Constants.TIMEOUT


#8

none :slight_smile: that was my time out constant I guess. Its just an integer


#9

is there a max time out limit ?


#10

Looking at https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/commands/timeout.js and https://github.com/appium/appium-support/blob/master/lib/util.js there is no limit defined in there.


#11

you can use “idleTimeout” capability to increase the session timeout