Package org.openqa.selenium.cli


package org.openqa.selenium.cli
Mechanisms to configure and run selenium via the command line. There are two key classes CliCommand and HasRoles. Ultimately, these are used to build a Config instance, for which there are strongly-typed role-specific classes that use a Config, such as DockerOptions.

Assuming your CliCommand extends TemplateGridCommand, the process for building the set of flags to use is:

  1. The default flags are added (these are HelpFlags and ConfigFlags
  2. ServiceLoader is used to find all implementations of HasRoles where HasRoles.getRoles() is contained within CliCommand.getConfigurableRoles().
  3. Finally all flags returned by CliCommand.getFlagObjects() are added.

The flags are then used by JCommander to parse the command arguments. Once that's done, the raw flags are converted to a Config by combining all of the flag objects with system properties and environment variables. This implies that each flag object has annotated each field with ConfigValue.

Ultimately, this means that flag objects have all (most?) fields annotated with JCommander's Parameter annotation as well as ConfigValue.