idle-timeout capability not working for Android test

1,887 views
Skip to first unread message

Jeffrey Blaze

unread,
Aug 6, 2013, 8:20:28 PM8/6/13
to appium-...@googlegroups.com
This desiredCapability works for when running a test against an iOS app (in the simulator, using appium.js server) but not when running a test against an Android app (in an AVD, using appium.js server):

capabilities.setCapability("idle-timeout", 900)

The server shuts down the Android app after 60 seconds.  It appears that the idle-timeout setting is ignored.



 

Jonathan Lipps

unread,
Aug 6, 2013, 8:22:22 PM8/6/13
to Jeffrey Blaze, appium-...@googlegroups.com
idle-timeout is a Sauce Labs-specific capability. It won't work for Appium locally, either iOS or Android. There's another capability Appium uses, I think it's newCommandTimeout? or commandTimeout?

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Al Villaflor

unread,
Aug 6, 2013, 8:41:29 PM8/6/13
to appium-...@googlegroups.com
it is executeScript("mobile: setCommandTimeout", timeout)

Jeffrey Blaze

unread,
Aug 6, 2013, 8:48:46 PM8/6/13
to Jonathan Lipps, appium-...@googlegroups.com
Oh.  But when I run my iOS test (locally) it doesn't time out after 60 seconds of inactivity.  In fact it doesn't time out at all.  I guess Android and iOS are handled differently.

Where would I find the capability you speak of?  I tried 'appium.js -help' thinking I would get a hint, but no dice.



Al Villaflor

unread,
Aug 6, 2013, 8:56:51 PM8/6/13
to appium-...@googlegroups.com, Jonathan Lipps

Al Villaflor

unread,
Aug 6, 2013, 9:00:53 PM8/6/13
to appium-...@googlegroups.com, Jonathan Lipps
it's not a capability. it is one of those appium mobile commands to set it.


On Tuesday, August 6, 2013 8:48:46 PM UTC-4, Jeffrey Blaze wrote:

Jeffrey Blaze

unread,
Aug 6, 2013, 9:13:22 PM8/6/13
to Al Villaflor, appium-...@googlegroups.com
Thanks Al.  You implied in another post that are more than one 'executeScript("mobile...)' commands.  Where are they documented? 



--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/UCSNlI3N5Cs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

Al Villaflor

unread,
Aug 6, 2013, 9:33:47 PM8/6/13
to appium-...@googlegroups.com, Al Villaflor
not all mobile commands are documented, so you have to dig in the code. look into the controller.js.

Jeffrey Blaze

unread,
Aug 6, 2013, 10:19:02 PM8/6/13
to Al Villaflor, appium-...@googlegroups.com
How about these capabilities:

capabilities.setCapability("record-video", true);

        capabilities.setCapability("record-screenshots", true);

        capabilities.setCapability("capture-html", true);

        capabilities.setCapability("max-duration", 3600);


Are those Sauce only (as is "idle-timeout")?  I looked at the mobile command map in controller.js and did not find analogs for them.



Jeffrey Blaze

unread,
Aug 6, 2013, 10:59:56 PM8/6/13
to Al Villaflor, appium-...@googlegroups.com
I also tried:

((JavascriptExecutor) driver).executeScript("mobile: setCommandTimeout", "{\"timeout\":\"30\"}");


and got the same result


---------- Forwarded message ----------
From: Jeffrey Blaze <jbl...@watercooler-inc.com>
Date: Tue, Aug 6, 2013 at 7:41 PM
Subject: Re: [appium-discuss] Re: idle-timeout capability not working for Android test
To: Al Villaflor <alvil...@gmail.com>


Thanks Al.  What is the exact syntax of the command (Java)?  I tried things like

((JavascriptExecutor) driver).executeScript("mobile: setCommandTimeout", 30);

((JavascriptExecutor) driver).executeScript("mobile: setCommandTimeout", "30");


And always got this exception

org.openqa.selenium.UnsupportedCommandException: Missing parameters: ["timeout"]

Jonathan Lipps

unread,
Aug 7, 2013, 12:08:28 AM8/7/13
to Al Villaflor, appium-...@googlegroups.com
actually in the code there is a capability:

{
  newCommandTimeout: 600
}

will set the command timeout to 10 minutes (value is in seconds)

Al Villaflor

unread,
Aug 7, 2013, 6:19:14 AM8/7/13
to appium-...@googlegroups.com, Al Villaflor
30 is not long enough. I would try 3600. And make the call after you start the driver.
((JavascriptExecutor) driver).executeScript("mobile: setCommandTimeout", 3600);

Jeffrey Blaze

unread,
Aug 7, 2013, 2:31:50 PM8/7/13
to Al Villaflor, appium-...@googlegroups.com
Thanks Al, but other than the timeout value itself, the example you provided is exactly the one that throws the error.  Also, you are suggesting an hour for a  command timeout.  Really?  I'm talking about a command timeout, not a script timeout (a la the "max-duration" capability).


Jeffrey Blaze

unread,
Aug 7, 2013, 2:33:28 PM8/7/13
to Jonathan Lipps, Al Villaflor, appium-...@googlegroups.com
So this in Java?

capabilities.setCapability(newCommandTimeout, 600);




--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/UCSNlI3N5Cs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

Jonathan Lipps

unread,
Aug 7, 2013, 2:34:07 PM8/7/13
to Jeffrey Blaze, Al Villaflor, appium-...@googlegroups.com
Jeffrey,

Did you see my e-mail yesterday about doing this via the newCommandTimeout desired cap? That might give you more luck.

Jonathan

You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.

Jeffrey Blaze

unread,
Aug 7, 2013, 2:37:36 PM8/7/13
to Jonathan Lipps, Al Villaflor, appium-...@googlegroups.com
Yes, my bad.  It's not a Sauce capability.  So I need to make an executeScript mobile call, right?  I can't get those to work.  There is another thread about that.

Jonathan Lipps

unread,
Aug 7, 2013, 2:50:13 PM8/7/13
to Jeffrey Blaze, Al Villaflor, appium-...@googlegroups.com
No, you can use the newCommandTimeout desired capability instead of using an executeScript mobile: call.

Jeffrey Blaze

unread,
Aug 7, 2013, 2:55:53 PM8/7/13
to Jonathan Lipps, Al Villaflor, appium-...@googlegroups.com
Okay, I'm confused.  My understanding is that it newCommandTimeout is a Sauce capability, not an Appium capability.  Correct?  If it were a Sauce capability I would set it with:

capabilities.setCapability("newCommandTimeout", 30);


Given that it is instead an Appium capability, and I am not to use an executeScript mobile: call, like this:

((JavascriptExecutor) driver).executeScript("mobile: newCommandTimeout", 30);


then how do I set the capability?

Jonathan Lipps

unread,
Aug 7, 2013, 3:00:51 PM8/7/13
to Jeffrey Blaze, Al Villaflor, appium-...@googlegroups.com
newCommandTimeout is an appium capability.

The other capabilities you mentioned (idle-timeout, max-duration, etc…, are Sauce capabilities)

So you can use newCommandTimeout with Appium, with or without Sauce

Pooja Shah

unread,
Mar 25, 2014, 3:12:01 AM3/25/14
to appium-...@googlegroups.com, Jeffrey Blaze, Al Villaflor
Using Appium latest "0.17.6" - newCommandTimeout throws "Not yet implemented. Please help us: http://appium.io/get-involved.html"
though "setCommandTimeout" works but never timeouts for IOS as Al Villaflor mentioned.

Jonathan Lipps

unread,
Mar 25, 2014, 3:16:30 PM3/25/14
to Pooja Shah, appium-...@googlegroups.com, Jeffrey Blaze, Al Villaflor
newCommandTimeout is not a command, it's a capability.

For more options, visit https://groups.google.com/d/optout.

Pooja Shah

unread,
Mar 26, 2014, 5:56:20 AM3/26/14
to Jonathan Lipps, appium-...@googlegroups.com, Jeffrey Blaze, Al Villaflor
ok, while setting as capability
setCapability("newCommandTimeout", 120); ---> never times out.
and setCapability("newCommandTimeout", 30); --> times out after 60 seconds.

Jonathan Lipps

unread,
Mar 26, 2014, 1:36:57 PM3/26/14
to Pooja Shah, appium-...@googlegroups.com, Jeffrey Blaze, Al Villaflor
Pass in the logs then please so we can see what's going on.
Message has been deleted

Mayuresh Shirodkar

unread,
Aug 28, 2014, 12:26:25 AM8/28/14
to appium-...@googlegroups.com, poojas...@gmail.com, jbl...@watercooler-inc.com, alvil...@gmail.com
Hi,
Appium always timesout after default 60 secs irrespective of setting the newCommandTimeout capability in my script.

I am using appium app on windows for android devices.
Appium version is :0.18.0

This are my desired capabilites which are set for appium:

DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
      capabilities.setCapability("platform", "Android");
      capabilities.setCapability("version", "4.1");
      capabilities.setCapability("newCommandTimeout", "120");
    driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

What should i do?
Appium_Log.png

Isaac Murchie

unread,
Aug 28, 2014, 12:15:49 PM8/28/14
to Mayuresh Shirodkar, appium-...@googlegroups.com, Pooja Shah, jbl...@watercooler-inc.com, alvil...@gmail.com
You should at least upgrade to 0.18.1, in which it should be fixed. I would recommend 0.18.2, at the least. There has, however, been much work since then. The latest version (1.2.2) is much more stable.
Reply all
Reply to author
Forward
0 new messages