Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Nov 02, 2017 15:23

Appium defines a processArguments capability, that allows an automation script to pass command-line arguments and environment variables to the application under test (AUT). The capability accepts a String array as process arguments and a dictionary as environment variables that include:

  • "args" - The application arguments.
  • "env" - the environment variables, provided as <name, value> pairs.

The following code snippet demonstrates how to use the capability:

// create a list object for the parameter arguments
final List<String> processArgs = new ArrayList<>(Arrays.asList("-debug"));

// create the JSON object to use as the capability value
JSONObject argsValue = new JSONObject();

// add the "args' to the capability value
argsValue.put("args", processArgs);

Map<String, String> processEnv = new HashMap<>();
// provide the environment variable and its value
processEnv.put("outfolder", "./output");
argsValue.put("env", processEnv);

// convert the two lists into a string array before passing to the capability
capabilities.setCapability("processArguments", argsValue.toString());