I'm doing an UI automation on mobile using Appium and need a API to check what app is running on top.
For android I have found that the driver.getCurrentPackage()
return the package name of the app. But couldn't find a similar one for the IOS driver.
loginPage.login(email,password);
if(!driver.getCurrentPackage().equals("my.app.package") {
throw RuntimeException("App crashed");
}
The above code works fine for the android mobiles, but need a way to make this work even for IOS mobiles.