How to retain session with appium when working on two diffrent devices


I am running testcases on two diffrent devices where i had to keep 1 device idle for some time till another executing some thing.

As far as I understand, appium can not handle two sessions at a time. You may want to run two instances of appium server on two different ports and configure tests on each device to use these ports.

I agree with @RamS , you need to handle all two instaces using thread level programming.

i am running two appium instances on two diffrent ports. still the time the script is executing in first device the appium of second device sent kill command

i am doing the same, but not facing this issue… I am using java 1.7 's util.concurrent package to handle concurrent sessions.

can u help me in this …
These are mine capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“device”, “Android”);


capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);
 return new AppiumDriver(new URL(""+Appiumport+"/wd/hub"), capabilities);

Though I have not tried it, I believe using the capability “newCommandTimeout” you can set wait time for next command in appium.
More details @

aliceTest = new AppTests("Alice");
bobTest = new AppTests("Bob");

aliceTest.installEnigma(); # [ That initialize web driver  for Alice]
bobTest.installEnigma();  #[ That initialize web driver  for Bob] 

Above both operation are sequential.

Collection<Callable<Void>> tasks = new ArrayList<Callable<Void>>();
            tasks.add(new Callable<Void>() {
                public Void call() throws Exception {
                    return null;

            tasks.add(new Callable<Void>() {
                public Void call() throws Exception {
                    return null;

executorService.invokeAll(tasks); # [ This method run two session parallel, and wont quite untill both method execute successfully] 

So this is very high level approach. You need to customized this as per your requirement.

Priyank Shah

i already used newcommandtime but it is not working for me

seems it is a high level i am not understanding it properly!!

has anyone had any luck with Selenium Grid?

Watch my videos. May be it will help you to solve you issues of selenium grid