There is method to get current activity in AndroidDriver:
driver.currentActivity()
which returns string like .MainActivity
without package name. Is there any way to get full activity name or application package separately?
There is method to get current activity in AndroidDriver:
driver.currentActivity()
which returns string like .MainActivity
without package name. Is there any way to get full activity name or application package separately?
Unfortunately, it's not yet possible.
Because Appium is using Selenium WebDriver, WD protocol should be extended / modified for that.
This method driver.currentActivity()
to get current activity based on the current page.
Use .getCapabilities()
to get package name and activity name:
//return package name
driver.getCapabilities().getCapability("appPackage").toString();
//return activity name, as generic (not based on current page)
driver.getCapabilities().getCapability("appActivity").toString();
Reference : Docs
You can fire ADB Command from your code Like: adb shell cd data/app ls