How to start Appium for iOS from screen which is not launch screen

platform : iOS

Screen 1: Default screen that is visible on App launch

Screen 2: This screen does not come by default and may be 2-3 steps down the line after screen1.

Now i want to start the Appium session with Screen 2 and not screen 1. How to do that?
I know this can be done using “appActivity” while initialising appium instance. Looking for an alternative for iOS.

I don’t think that this can be done on iOS. My suggestion would be to use a setup or before method to get the app into the state you need for testing.

Hello Shankar Garg Sir,

I know this can be done using “appActivity” while initializing appium instance
Does this means we provide Screen 2 activity name in Desire Capability while creating appium Instance ?
But I have impression that it is must to pass only Launchable activity … Please correct me if I am wrong.

Can u share your first solution please for our learning ?

Regards,
Amit Jain

@wreed: yeah, we are doing that already. just wanted to confirm there is no alternative like Android.

@amitjaincoer191: Please refer below code:
capabilities.setCapability(“browserName”, “”);
capabilities.setCapability(“platform”, “Android”);
capabilities.setCapability(“deviceName”, “AndroidPhone”);
capabilities.setCapability(“platformVersion”, “9.0”);

** capabilities.setCapability(“appPackage”, “com.xxxx.xxxx.xx”);**
** capabilities.setCapability(“appActivity”, “com.xxx.xxx.MainActivity”);**

             final File appDir = new File("/Users/xxxx/xxx/xxxx");
	    final File app = new File(appDir, "xxxxx.apk");
                capabilities.setCapability("app", app.getAbsolutePath());

	    driver = new AndroidDriver(uri, capabilities); 

appPackage and appActivity can be used to define from where to start android driver.

Does it means activity we pass while creating session with appium server is not mandatory to be launchable activity of app ?? Please clarify ?

yes. activity we pass while creating session with appium server is not mandatory to be launchable activity of app