Waiting for the device or/and app being ready

Hi all,

i have a problem automating proper.

First i create android devices with "android create -name ‘MyName’ ".
Than i want to bind my test to a device with a name i gave to it. Unfortunately the devices are looked up with the os given id and can not be found by my given name.

So first, how can i create a device and proper use an id to use it afterwards?

Second i start the test/driver with the capabilities and wait for an element, which i want to be in my first page.
And here comes the next question. The timeout counter starts immediately and messes with time the emulator starts and the app is installed.

Somehow i expect the framework to supsend my thread getting everything up and running, which does not happen. I dont want to mess with timeouts for the device and app being ready.

So is there something in there for this concept or do i just have to wait infinit for the app beaing ready to test.

Thx for your time.

At the outset, below steps should work - [Though I need time to get the working scripts]

  • Write shell script which should create and ensure [with delays] that Emulator is up and running. This should be most likely pre-build script if you are using CI
  • You can use the OS version to target the tests. In 1.5.3 deviceName is made mandatory. Need to check if this is of any help.
  • Introduce delay using Sleep to identify / ensure correct page is loaded.

Thx for replying and your suggestions.

I was thinking of scripts and code for getting it all by myself but since the driver can start the emulator by itself i was thinking that the other work can also be done by the driver.

The deviceName seems to be not what it is. When i create a device with name “device1” and call adb devices, something like emulator-5558 shows up. So there is a generated identifier involved. Appium seems to need this identifier and not the name i was creating the device with.

Sleeps and timeouts are not really something what i want to do at this abstraction level. Of course when i program it by myself i can timeout the specific flows as i want, but waiting for an element considering the startup is not what i want. Testing with timeouts in general leads to waggly tests so they only makes sense for me at the level they are pointing the real issue

Normally what you do is wait for an element that is on launcher page to be identified. But try not to use sleeps, instead use one of these:


Where you define the max time that it is acceptable to wait for before it throws an exception.

Hi, thx for your reply.

To clarify: I needed something where i can separate timeouts for the different steps for getting the app ready for test.
These steps are.

  1. Creating a device

  2. Binding the device to SeleniumGrid/Appium

  3. Starting the device

  4. Installing the app

  5. Starting the app

The question here was about step 3-5 which i wanted not being part of the timeout for the ui WebDriverWait.

Since appium is able to do these 3-5 steps i was wondering if there is something special for these steps.
In general the startup of the device is not really relevant to a test but the startup of an application can be relevant to a test, since the enduser will not accept apps taking more than (lets say) 30-60 sec.

I solved my problems with parsing the Process.getInputStream() for specific matches.

For example 3. Starting the device -> adb -s ‘id’ shell getprop init.svc.bootanim for output “stopped”, which means that the booting sequence is done.