Query for connected devices before the driver started

Hello :slight_smile:

How can I query for connected devices platform and model before the driver is initialized ?

If the connected device is iOS then start the proper iOS driver and App bundleId
If Android then do accordingly.


You would need to code that yourself. I have something similar where we automatically get the uuid before starting Appium, searching connected devices by name. However you programmatically start Appium, run your code first and set capabilities accordingly. There are many approaches, you’ll need to find the one that fits your testing infrastructure and coding language best. I’d try an algorithm like:

  1. query for real device with ‘idevice_id -l’ which should be installed with libimobiledevice
  2. if query is null, use adb to query for devices, ‘adb devices’ (note you’ll have to parse out any emulators, there may be a better command for this)
  3. set capabilities and start Appium

Good luck!

Thanks for the reply :slight_smile:

I’ll sure try to query for real device\s by your suggestion.

Cheers !