How to use driver.startActivity on IOS?

Hi I was building some tests for Android and now I want to run the same tests on IOS. Sometimes in my code I have to open google chrome then go back and launch the app, for that I use
driver.startActivity("com.consul.android.smartbeer.staging", "com.whirlpool.ted.View.SplashActivity");
and
driver.startActivity("com.android.chrome", "com.google.android.apps.chrome.Main");
My question is: how can I use a similar command for IOS? I know that it has driver.launchApp(); but If I insert the Bundle_Name it doesn’t work. Is there another way?

Hi Lucas,

You could try to use the Appium SeeTest Extension, which will give you the capability to use the method launch.

So if you would wish to open let us say Safari, then doing the following would suffice:

driver.launch("com.apple.mobilesafari", false, false);

You could use this command more than once.

As for doing it from Appium Commands, I am not entirely sure how you’d be able to achieve that since IOS behaves differently, usually you launch it with the DesiredCapabilities at the beginning of the test but you wish to switch apps in the middle of tests, maybe someone can fill in for me if I am missing something?

1 Like

It worked. Do you know how can I find the path “com.apple.mobilesafari”?

On this link all the way down there is a dropdown list for all the Native Bundle IDs, otherwise a google search would usually give you the answer.

If you want to find it programmatically, I am not aware of a way to do this from Appium Studio, if you are using SeeTestAutomation Studio then there is an inbuilt command:

client.getCurrentApplicationName();

1 Like