How can we call "activateApp" with launch arguments?

In Java we’re trying to startup just using the launcher, then remove any and all apps that would store generic data (we have 3 apps that could store user-data, let alone dev, mainline, prerelease, and release) on the phones. We then install the app, then start it up. However, we often need to run against different servers, and we have arguments to facilitate that. With iOS however, the activateApp call doesn’t seem to be using our arguments we’re passing it. Based on documentation the following code should work, but doesn’t seem to be doing anything (Note, using the processArguments works when only starting up the app directly).

NOT WORKING:

driver.activateApp(appDetail, new BaseActivateApplicationOptions() {
   @Override
   public Map<String, Object> build() {
      return Map.of("arguments", "--host https://api.test.com");
   }

});

WORKING:

   final List<String> processArgs = List.of("--host", "https://api.test.com");
   final JSONObject argsValue = new JSONObject();
   argsValue.put("args", processArgs);
   capabilities.setCapability("processArguments", argsValue.toString());

Any ideas here would be helpful. Thanks!

Try to call https://github.com/appium/appium-xcuitest-driver#mobile-terminateapp and then https://github.com/appium/appium-xcuitest-driver#mobile-launchapp instead. activateApp is used to activate an already running app and it does not make much sense to send any arguments to it in such case.

So the flow you’re proposing is to do a regular “app” capability, terminate, uninstall all versions, re-install AUT, then launchApp? (launchApp() takes no arguments in the java client, so we’d have to change our initial flow).

Also of note, this is really only iOS as we have our startup activity in Android so we can follow the other flow of just running the “launcher”, then uninstalling all previous versions, then install the new one, and launch the activity.

not really. Don’t mix the mobile: launchApp extension with the deprecated launchApp call in java client.

Perfect! That worked with starting the launcher by default, uninstalling all apps that match a package regex, and then directly calling mobile:launchApp. Are there plans on wrapping that call with a java equivalent?

I don’t see much sense in creating wrappers as these extensions are different for different drivers and could be a subject of change. IMHO executeScript API is flexible enough