Search code examples
pythonadblogcatappiumpython-appium

Check which app is currently open on device


I can launch app through appium and use that driver to do UI interaction through Python. But I am trying to launch app through python script. e.g. facebook app. Can I determine which app is currently open? Or can I use appium to do UI interaction on currently open app?

I want to know which app is currently open or which url is launched either in playstore on in browser? Can appium handle this or I need to use something else? Or can I use adb to pull this info?


Solution

  • You can try driver.current_activity method:

    From manual:

    Retrieving the current running activity The property method driver.current_activity returns the name of the current activity running on the device.

    activity = driver.current_activity
    assertEquals('.ApiDemos', activity)