skip to content

In Appium, why must you pass --use-plugins at server start when --use-drivers is optional?

level: middleimportance: should knowfreq 44%

answer

  1. install and activate are separate steps
  2. drivers default on, plugins default off
  3. one flag narrows, the other opts in
  4. plugins intercept every session's commands

basics

~20 s

Installing an Appium extension and activating it are different steps. Every installed driver is active by default, so --use-drivers only narrows the set; no plugin runs unless --use-plugins names it, because a plugin sits in every session's command path.

solid answer

~40 s

Installation writes to an `APPIUM_HOME`; activation is a property of one server process. Appium activates **every installed driver** by default, because a driver only participates when a session's capabilities match it - a host holding the UiAutomator2 driver for **Android** and the XCUITest driver for **Apple platforms** can serve both, and neither touches the other's traffic. `--use-drivers` therefore only narrows that set. Plugins are the opposite: a plugin can intercept or add commands for every session regardless of which driver answers, so none is active unless `--use-plugins` names it, or you pass the value `all`. That is why a plugin you just installed appears to do nothing - it is installed and inactive, exactly as designed.

go deeper

for a junior

Remember that an installed Appium plugin does nothing until a server is started with --use-plugins naming it, while drivers you installed are already active - installing a plugin is only half the job.

for a middle

Explain the asymmetry: a driver participates only when a session's capabilities match it, while a plugin sits in every session's command path, which is why drivers default on and plugins default off.

for a senior

Demonstrate the triage - when a plugin seems dead or a driver suddenly fails to match, read the command that started the server, because activation is per process while installation is per APPIUM_HOME.

for a principal

Argue for treating the start command as reviewed configuration. Activation is repeated on every start, leaves no trace on the machine, and a silently inactive plugin turns into tests that pass without checking anything.

## Installing an extension is not activating it Appium's extension system has two distinct steps, and conflating them is the whole of this question. **Installation** is a state of an `APPIUM_HOME` directory: `appium driver install uiautomator2` or `appium plugin install images` fetches a package into that home and records it in the `extensions.yaml` manifest. **Activation** is a property of one server process: which of the installed extensions that process loads when it starts. `--use-drivers` and `--use-plugins` are the activation controls, and their defaults are deliberately asymmetric. - Every installed **driver** is activated by default; `--use-drivers` exists only to narrow that set. - No installed **plugin** is activated by default; `--use-plugins` exists to opt in, by name or with the value `all`. ## Why the two defaults differ The asymmetry follows from what each extension kind does to a session. A driver is *selected*, not *applied*. It participates only when a session request's capabilities match what it claims, so a host with the UiAutomator2 driver (**Android**) and the XCUITest driver (**Apple platforms**) both installed can serve either kind of session, and neither driver affects the other's traffic. Leaving them all active is therefore free of behavioural surprise; the costs are startup time and memory, not correctness. A plugin is *applied*. It sits in the command path and may intercept, replace or add commands for **every** session the server handles, whichever driver answers. An extension with that reach must not switch itself on merely because somebody installed it once on a machine other people also use. Opt-in is the safe default, and it explains the symptom that brings people to this question: a freshly installed plugin that appears to do nothing is installed and inactive. ## Writing the flags - `appium --use-plugins=images` activates one plugin for this process. - `appium --use-plugins=all` activates every plugin the home holds. - `appium --use-drivers=uiautomator2` restricts the process to the **Android** UiAutomator2 driver, so an Apple-platform session request will not match on that host. - Both flags take a comma-separated list and name extensions exactly as the install and list subcommands do. Because activation is per process, two servers started from the same `APPIUM_HOME` can carry different extension sets. That is a legitimate technique when one host serves two suites with different plugin needs, and a confusing one when it happens by accident. ## The failures this asymmetry produces | Symptom | Usual cause | |---|---| | A plugin is installed but nothing it adds appears | the process started without `--use-plugins` naming it | | A plugin works on one host and not another | the flag lives in one start command and not the other | | A session that used to match now finds no driver | `--use-drivers` was added and left the needed driver out | | Two servers behave differently from one install | activation is per process even though the manifest is shared | Triage in three steps: 1. Confirm what the home holds: `appium driver list --installed` and `appium plugin list --installed`. 2. Confirm what the process was told to load: read the command that started the server, not your install history. 3. Confirm which server the client actually reached, since activation travels with the process and the manifest does not. ## Treat the start command as configuration The practical discipline is to keep the activation flags with whatever starts the server rather than in somebody's shell history. An install is a one-off act on a directory and leaves evidence in the manifest; activation is repeated on every start and leaves no evidence on the machine at all. That difference is why the plugin half of this question bites hardest: a driver that is not active fails loudly, because sessions stop matching, while a plugin that is not active fails silently - the commands it would have added are simply not there. So a suite that depends on a plugin's added commands should assert that dependency rather than assume it. For a **library loan-renewal** suite whose checks lean on a plugin, an inactive plugin is the difference between a red test and a green one that verified nothing, and the flag deciding which of those you get is on the start command, not in the install log.

  • Why is activating every installed driver safe when activating every installed plugin is not?
    A driver only answers a session whose capabilities match it, so an idle driver never touches another session's traffic; the cost of leaving it active is startup time. A plugin can intercept or add commands for every session on the server, whichever driver answers, so switching one on changes behaviour nobody asked to change.
  • Two Appium servers started from the same APPIUM_HOME behave differently - what explains that?
    Activation is per process. The `extensions.yaml` manifest under `APPIUM_HOME` says what is installed; `--use-drivers` and `--use-plugins` on each start command say what that process loaded. Two processes over one home can legitimately run different plugin sets, so compare start commands before you suspect the install.

saying these in an interview costs you the question

  • Thinks installing a plugin is enough to make it run
  • Believes --use-drivers is required before any session can match
  • Assumes an inactive plugin announces itself with an error
  • Confuses what an APPIUM_HOME holds with what a process loaded
  • Thinks a plugin only affects the driver it was written for