How to open device settings through driver

I can launch app through appium by giving required details. And I can perform UI interactions using find_element_by_xpath.

But how can I open in built apps e.g.device settings

Can I minimize the app? how can I launch device settings? I didn’t see option to click in apps (grid icon)

Try to launch driver with capability having activity com.android.settings.Settings

desired_caps = dict()
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '6.0'
        desired_caps['deviceName'] = 'Android Emulator'
        desired_caps['appActivity'] = 'com.android.settings.Settings'
        desired_caps['newCommandTimeout'] = 1000
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

It gives error: No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device)

1 Like

Set package to com.android.settings

got it, I installed app info app to get package name and activity name.
e.g. this is for google settings app.

desired_caps = dict()
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '6.0'
        desired_caps['deviceName'] = 'Android Emulator'
        desired_caps['appActivity'] = 'com.google.android.gms.app.settings.GoogleSettingsActivity'
        desired_caps['appPackage'] =  'com.google.android.gms'
        desired_caps['newCommandTimeout'] = 1000
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

Good to know… :slight_smile: