Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Flutter and app store releases

Appium will not start a session without automationName

Your error

OpenQA.Selenium.WebDriverException: ''automationName' can't be blank'3 more lines it can show

Fix it fast

Most common cause, 1 of 3

The session request has no automationName at all

Add the capability with the appium: prefix.

Fix
var options = new AppiumOptions();
options.PlatformName = "Android";
options.AutomationName = "UiAutomator2";
options.DeviceName = "emulator-5554";
options.App = "/path/to/app.apk";
var driver = new AndroidDriver(new Uri("http://127.0.0.1:4723/"), options);
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Appium returns 'automationName' can't be blank on older 2.x servers, or 'automationName' is required to be present on current ones, when the session request has no appium:automationName capability. Appium 2 and later pick the driver by that name. Set it to UiAutomator2 for Android or XCUITest for iOS (C#: AppiumOptions.AutomationName) and install that driver. Applies to Appium 4.0.

  • Applies to Appium server 4.0.0 (older 2.x servers print can't be blank), Appium.WebDriver 9.0.0 for .NET, UiAutomator2 and XCUITest drivers
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Search the test code for how the automation name is set, then list the drivers installed on the server. No hit in the code is cause 1, an AddAdditionalAppiumOption call for it is cause 2, and a name with no matching installed driver is cause 3.

Run this first
grep -rn -i "automationName" --include=*.cs --include=*.py --include=*.java --include=*.js --include=*.ts .
appium driver list --installed

Then find the line you see in this list and open its fix:

  1. 1The session request has no automationName at allThe capabilities in the code set platformName, deviceName and app, but nothing called automationName
  2. 2C# code adds automationName as an extra optionThe test fails on the client side with an ArgumentException that says to use the AutomationName property
  3. 3No installed driver matches the name you sentThe error changes to Could not find a driver for automationName ... and appium driver list --installed does not show that driver

What does the error look like?

  • OpenQA.Selenium.WebDriverException: ''automationName' can't be blank'
  • 'automationName' is required to be present
  • There is already an option for the appium:automationName capability. Please use the AutomationName property instead.
  • Could not find a driver for automationName 'UiAutomator2' and platformName 'Android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see.

Cause 1 of 3

The session request has no automationName at all

You seeThe capabilities in the code set platformName, deviceName and app, but nothing called automationName

Check

Appium's server checks every new session against two required capabilities, platformName and automationName. Since Appium 2 the server picks a driver only by the automationName you send, so a request without it fails validation: older servers word it as can't be blank, current ones as is required to be present.

Check
grep -rn -i "automationName" tests/ || echo "automationName is not set anywhere"

Fix

Add the capability with the appium: prefix. The UiAutomator2 driver answers to UiAutomator2 on Android and the XCUITest driver to XCUITest on iOS. The .NET client has a typed property that sends appium:automationName for you.

Fix
var options = new AppiumOptions();
options.PlatformName = "Android";
options.AutomationName = "UiAutomator2";
options.DeviceName = "emulator-5554";
options.App = "/path/to/app.apk";
var driver = new AndroidDriver(new Uri("http://127.0.0.1:4723/"), options);

Verify

The server log prints The 'uiautomator2' driver was installed and matched caps, and the test reaches its first step.

Verify
dotnet test

Confirmed by appium.io

Did this fix it?

Cause 2 of 3

C# code adds automationName as an extra option

You seeThe test fails on the client side with an ArgumentException that says to use the AutomationName property

Check

AppiumOptions in the .NET client registers appium:automationName as a known capability tied to its AutomationName property. AddAdditionalAppiumOption puts appium: in front of names that have no colon and then checks the name, so passing automationName that way throws before any request leaves the machine.

Check
grep -rn "AddAdditionalAppiumOption(\"automationName\"\|AddAdditionalAppiumOption(\"appium:automationName\"" --include=*.cs .

Fix

Delete that call and set the property instead. Keep AddAdditionalAppiumOption for capabilities that have no typed property, such as driver-specific settings.

Fix
// remove:
// options.AddAdditionalAppiumOption("automationName", "UiAutomator2");
options.AutomationName = "UiAutomator2";
options.AddAdditionalAppiumOption("noReset", true);

Verify

The ArgumentException is gone and the session request reaches the server.

Verify
dotnet test --filter FullyQualifiedName~Smoke

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 3

No installed driver matches the name you sent

You seeThe error changes to Could not find a driver for automationName ... and appium driver list --installed does not show that driver

Check

Since Appium 2, installing the server installs no drivers at all. Once automationName is present, the server looks for an installed driver that declares that automation name and platform; when none is found it raises the 'Could not find a driver' error and suggests listing installed drivers.

Check
appium driver list --installed

Fix

Stop the Appium server, install the driver for your platform and start the server again. The install output prints the automationName the driver expects, which must match your capability.

Fix
appium driver install uiautomator2   # Android only
appium setup mobile                  # UiAutomator2, Espresso, and XCUITest on macOS
appium

Verify

appium driver list --installed shows the driver with automationName UiAutomator2 or XCUITest, and a new session starts.

Verify
appium driver list --installed

Confirmed by appium.io

Did this fix it?

How do I stop it coming back?

  • Keep one shared capabilities builder for the whole test suite so platformName and automationName are set in one place.
  • Install drivers in the CI image or a setup script with appium driver install, and print appium driver list --installed in the job log.
  • Use the typed properties of AppiumOptions for standard capabilities and keep AddAdditionalAppiumOption for driver extras.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: QistLock, Nuclear Home Video, Raheeb.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.