結論
Appium は、Android・iOS などのアプリを WebDriver の仕組みで外から操作し、テストを自動化するオープンソースのツールです(Apache-2.0)。2026年11月26日時点の最新は Appium 4.0.1 で、Node.js 22.22.2 以上などを入れたうえで npm i -g appium で本体を入れ、appium driver install uiautomator2(Android)や xcuitest(iOS)でドライバーを足してから使います。本体だけでは何も操作できません。
この記事でわかること
- Appium の仕組み(サーバー・ドライバー・クライアント・プラグイン)と、Appium 4 で変わった点
- インストール、ドライバーとプラグインの入れ方、
appium driver doctorの読み方(実際の出力つき) - capabilities の書き方と、セッションが作れないときのエラー原文と直し方
テストのコードから端末までの流れです。テストのコードは Appium サーバーに HTTP で命令を送り、サーバーは capabilities に合うドライバーを選んで、そのドライバーが端末を操作します。
flowchart TD
A[テストのコード<br>Python・Java など] -->|HTTP・WebDriver| B[Appium サーバー<br>127.0.0.1:4723]
B --> C{automationName と<br>platformName}
C -->|UiAutomator2| D[Android の端末<br>エミュレーター]
C -->|XCUITest| E[iPhone・iPad<br>シミュレーター]
検索の多い言い回しから順に並べました。
| 知りたいこと | 答え | 詳しい節 |
|---|---|---|
| Appium とは | モバイル・デスクトップなどのアプリを WebDriver の形で自動操作するオープンソースの枠組み。テストのコードは Python・Java などで書く | Appiumとは |
| appium 無料 | Apache-2.0 のオープンソースで、本体・公式のドライバーは npm から入れられる | Appiumとは |
| appium 最新バージョン | 4.0.1(2026年11月23日公開)。4.0.0 は2026年11月15日公開。サポートは最新の版だけ | Appium 4で変わったこと |
| appium インストール | Node.js(^22.22.2 か ^24.15.0、または 26 以上)と npm 10 以上で npm i -g appium | インストール |
| appium ドライバー 入れ方 | appium driver install uiautomator2。一覧は appium driver list | ドライバーの入れ方 |
| appium 使い方(最初の手順) | 本体→ドライバー→appium driver doctor→サーバー起動→クライアントからセッション作成 | インストール/クライアント |
| appium capabilities | platformName と appium:automationName が要る。Appium 独自の項目は appium: を付ける | capabilitiesの書き方 |
| appium inspector | 画面の要素を見て探し方を確かめる GUI。デスクトップ版とプラグイン版がある | Appium Inspector |
| appium selenium 違い | Selenium はブラウザ、Appium はアプリ(ネイティブ・ハイブリッド・モバイルの Web)。どちらも WebDriver の形 | Selenium・Playwrightとの違い |
確認環境:Appium の機能・要件・手順は、Appium の公式の文書(npm で配られる appium パッケージ 4.0.1 の README と、そこから案内される公式の文書)、各ドライバーの公式の文書(appium.github.io の UiAutomator2 Driver・XCUITest Driver・Appium Inspector)、公式のクライアント(Appium Python Client・java-client)の README で確かめました。実際に動かしたのは、Ubuntu 24.04.5 LTS の Node.js 22.23.4・npm 10.9.9 での Appium 4.0.1 のインストール、UiAutomator2 Driver 10.4.0 と Inspector プラグイン 2026.11.6 の追加、appium driver doctor、127.0.0.1 だけで待ち受けるサーバーの起動と /status・/session への curl、Python 3.13.18 の Appium-Python-Client 6.1.8(Selenium 4.54.0)からの接続、設定ファイルの読み込みです。Android の SDK・端末・エミュレーターにはつないでいないので、セッション作成はドライバーの手前の段階までの出力です。Appium Inspector のデスクトップ版と、iOS の XCUITest の画面の動作はこの環境では確かめていないため、公式の文書の記載どおりに書いています。Java のコードは公式の README の形です(確認日 2026年11月26日)。
本記事の内容は、ご自由にお使いください。
ご利用の際は、出典として本ページへのリンクを記載いただけますようお願いします。
(記載例)出典:株式会社RJC「Appiumとは|スマホテスト自動化の始め方とドライバーの入れ方【Appium 4】」
Appiumとは|スマホアプリのテスト自動化でできること
この節では、Appium が何を自動化するツールなのか、無料で使えるのか、何が得意なのかが分かります。
Appium は、WebDriver の仕様にもとづいて、モバイル・デスクトップ・IoT などのアプリを自動で操作できるオープンソースの枠組みです。公式の README では「Cross-platform test automation for native, hybrid, mobile web and desktop apps」と紹介されています。ライセンスは Apache-2.0 です。
自動化できるアプリの種類は次の3つです。
1ネイティブアプリ
Android の apk、iOS の app など、端末に入れて動かすアプリ。ボタンを押す・文字を入れる・画面を読むといった操作をテストのコードから行う。
2ハイブリッドアプリ
アプリの中に Web の画面(WebView)を持つもの。公式の README では、xcuitest や uiautomator2 などのドライバーは同じスクリプトの中でネイティブと WebView を切り替えられると説明されている。
3モバイルの Web
スマホのブラウザで開く Web ページ。iOS の Safari、Android の Chrome などを操作する。
4デスクトップ・ブラウザ
公式のドライバーには macOS のアプリ用(mac2)、Windows 用(wincore)、Safari・Firefox(gecko)・Chromium 系のブラウザ用もある。
公式の README の「Why Appium?」には、Appium を選ぶ理由として次の点が挙がっています。
- 各プラットフォームの標準の自動化の仕組みを使うので、たいていはアプリを作り直したり変えたりせずに済む
- Java・Python・Ruby・C# など WebDriver に対応した言語で書け、テストの枠組みも選べる
- 手元でもクラウドのサービスでも動かせる(iOS・Android を中心に、Appium のドライバーに対応した事業者が複数ある)
- Appium Inspector で画面の構造(ページソース)を見ながらテストを作れる
Apple の XCUITest をそのまま使うと Objective-C か Swift で書き Xcode から動かすことになり、Google の UiAutomator や Espresso では Java か Kotlin で書くことになる、と README は書いています。1つの書き方で Android と iOS の両方を同じ形で扱えることが、Appium の一番の特徴です。
Appiumの仕組み|サーバー・ドライバー・クライアント・プラグイン
この節では、Appium を構成する4つの部品と、それぞれを何で入れるかが分かります。
Appium 2 以降の Appium は、本体(サーバー)と、プラットフォームごとの部品を分けて入れる形です。公式の README は「core Appium server は単体では何も自動化できない。対象のプラットフォームのドライバーを入れる」と書いています。
| 部品 | 役割 | 入れ方 |
|---|---|---|
| サーバー(appium) | HTTP で WebDriver の命令を受け、ドライバーに渡す。既定のポートは 4723 | npm i -g appium |
| ドライバー | 特定のプラットフォームを操作する。Android は UiAutomator2・Espresso、iOS は XCUITest など | appium driver install <名前> |
| クライアント | テストのコードを書くためのライブラリ。公式は Java・Python・Ruby・.NET C# | 各言語のパッケージ管理(pip・Maven など) |
| プラグイン | サーバーの機能を足す。Inspector・画像の比較など | appium plugin install <名前> |
ドライバーとプラグインの違いについて、README は「入れたドライバーはすべて既定で有効になるが、プラグインはサーバーの起動時に --use-plugins で明示して有効にする」と説明しています。
ドライバーとプラグインの置き場所は APPIUM_HOME で、指定しなければホームの .appium です(appium 4.0.1 のソースの DEFAULT_APPIUM_HOME で確かめました)。入れたものの一覧は、その中の node_modules/.cache/appium/extensions.yaml に書かれます。実際に UiAutomator2 と Inspector を入れたあとの中身の一部です(ホームのパスは ~ に置き換えています)。
drivers:
uiautomator2:
pkgName: appium-uiautomator2-driver
version: 10.4.0
installType: npm
installSpec: uiautomator2
installPath: ~/.appium/node_modules/appium-uiautomator2-driver
appiumVersion: ^4.0.0-beta.8
automationName: UiAutomator2
platformNames:
- Android
plugins:
inspector:
pkgName: appium-inspector-plugin
version: 2026.11.6
installType: npm
installSpec: inspector
appiumVersion: ^3.0.0-beta.0 || ^4.0.0-beta.0
schemaRev: 4
appiumVersion が、そのドライバーやプラグインが対応する Appium の版の範囲です。本体の版を上げたら、ここが合っているかを見ます。
Appium のクライアントは WebDriver の命令を送る仕組みなので、ブラウザ向けの WebDriver の考え方がそのまま使えます。WebDriver そのものの仕組みは、関連記事「WebDriverとは|仕組み・ChromeDriverとバージョンエラーの直し方」で扱っています。
Appiumの今の版|Appium 4で変わったこと(2系・3系との違い)
この節では、2026年11月26日時点の版と公開日、Appium 4 で要件や書き方がどう変わったかが分かります。
npm の公開日で並べると次のとおりです(2026年11月26日時点)。公式の README には「Appium チームは最新の版だけをサポートする」とあり、メジャーの版を上げるときは公式の移行ガイド(v1→v2、v2→v3、v3→v4)を見るよう案内されています。
| 版 | 公開日(npm) | メモ |
|---|---|---|
| 4.0.1 | 2026年11月23日 | latest(最新) |
| 4.0.0 | 2026年11月15日 | Appium 4 の最初の正式版 |
| 3.9.1 | 2026年11月14日 | 3系の最後の版(2026年11月26日時点) |
| 3.0.0 | 2025年8月18日 | Appium 3 の最初の正式版 |
| 2.19.0 | 2025年6月1日 | 2系の最後の版 |
Appium 4.0.1 を入れて、公式の文書と照らして分かった違いをまとめます。
Appium 4(4.0.1 で確かめた)
Node.js は ^22.22.2・^24.15.0・26 以上(package.json の engines)。npm は 10 以上
--allow-cors は無く、指定すると「Unrecognized arguments」で止まる。Inspector の起動のしかたは公式の Getting Started を確かめる
公式のドライバーは Appium 4 対応の版を入れる(UiAutomator2 は 9.0.0 以降、XCUITest は 13.0.0 以降)
Appium 2・3 から引き継いだ形
本体とドライバーを別に入れる(Appium 2 から)
既定の URL は http://127.0.0.1:4723。Appium 1 の /wd/hub は付かない
capabilities は W3C の形で、Appium 独自の項目には appium: を付ける
UiAutomator2 Driver の変更履歴には、9.0.0(2026年11月1日)の破壊的変更として「Appium 4.0.0-beta.0 以上が必要、Node 20 のサポートをやめ、最低は ^22.22.2 || ^24.15.0 || >=26.0.0(Appium 4 と同じ)」と書かれています。XCUITest Driver の公式の要件のページでは、ドライバー 13.0.0 以降が Appium 4、10.0.0〜12.22.8 が Appium 3、4.0.0〜9.10.5 が Appium 2 に対応すると整理されています。
Appium 1 からいきなり上げる場合について、README は「先に Appium 1 を完全にアンインストールする(npm uninstall -g appium)。そうしないと思いがけないエラーが出ることがある」と書いています。
Appiumのインストール(npm)と動作の確かめ方
この節では、Appium 本体の入れ方、入ったかどうかの確かめ方、入れたときの大きさと時間が分かります。
公式の README は「Appium は npm で入れる(ほかのパッケージ管理には今は対応していない)」と書いています。先に Node.js の版を確かめます。
$ node -v
v22.23.4
$ npm -v
10.9.9
$ npm i -g appium
$ appium --version
4.0.1
Node.js の版が engines の範囲から外れていると、npm が警告を出したり Appium やドライバーが動かなかったりします。Node.js の版を切り替える方法は、関連記事「Node.js バージョン管理|nvm・fnm・mise・Volta比較と実測」で扱っています。
Node.js と npm の版を確かめる
Appium 4.0.1 は Node.js ^22.22.2・^24.15.0・26 以上、npm 10 以上。
本体を入れる
npm i -g appium。プロジェクトごとに版をそろえたいなら、プロジェクトの依存に入れて npx appium で動かす形もある。
ドライバーを入れて doctor で点検する
appium driver install uiautomator2 のあと appium driver doctor uiautomator2。
サーバーを起動して /status を見る
appium --address 127.0.0.1 で起動し、http://127.0.0.1:4723/status が "ready":true を返すか確かめる。
実際に入れたときの量です(Node.js 22.23.4・npm 10.9.9、2026年11月26日)。
このほかに、Android なら Android SDK と JDK、iOS なら macOS と Xcode が要ります(次の節)。Appium 本体はどの OS にも入りますが、iOS のテストは macOS が前提です。
Appiumのドライバーの入れ方|UiAutomator2・XCUITest・Espresso
この節では、公式のドライバーの一覧と入れ方、更新・削除のコマンド、Android と iOS で要るものが分かります。
名前だけで入れられる公式のドライバーは appium driver list で出ます。Appium 4.0.1 で何も入れていない状態の出力です。
$ appium driver list
✔ Listing available drivers (rerun with --verbose for more info)
- uiautomator2 [not installed]
- xcuitest [not installed]
- espresso [not installed]
- mac2 [not installed]
- wincore [not installed]
- safari [not installed]
- gecko [not installed]
- chromium [not installed]
| 名前 | npm のパッケージ | 対象(npm の説明) | 最新版(2026年11月26日) |
|---|---|---|---|
| uiautomator2 | appium-uiautomator2-driver | Android(UiAutomator2) | 10.4.0 |
| espresso | appium-espresso-driver | Android(Espresso) | 11.0.1 |
| xcuitest | appium-xcuitest-driver | iOS(XCUITest) | 13.8.0 |
| mac2 | appium-mac2-driver | macOS のアプリ | 5.1.1 |
| wincore | appium-wincore-driver | Windows | 4.1.3 |
| chromium | appium-chromium-driver | Chromium 系のブラウザ | 5.0.0 |
入れる・更新する・消すのコマンドは README のとおりです。
# 公式のドライバーを入れる
appium driver install uiautomator2
# 版を決めて入れる(UiAutomator2 Driver の文書の例は [email protected] の形)
appium driver install [email protected]
# npm にある公式以外のドライバーを入れる
appium driver install --source=npm <パッケージ名>
# 入っているものの一覧
appium driver list --installed
# 更新(メジャーの版は上げない)
appium driver update uiautomator2
# メジャーの版まで上げる(破壊的な変更を含むことがある)
appium driver update uiautomator2 --unsafe
# 削除
appium driver uninstall uiautomator2
実際に UiAutomator2 を入れたときの出力です。どの automationName と platformNames に対応するかが最後に出ます。これが capabilities に書く値になります。
$ appium driver install uiautomator2
✔ Checking if 'appium-uiautomator2-driver' is compatible
✔ Installing 'uiautomator2'
✔ Validating 'uiautomator2'
ℹ Driver [email protected] successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]
Appium 4.0.1 には、決まった組み合わせをまとめて入れる appium setup もあります。ヘルプの説明では、Linux の上での既定の mobile は uiautomator2・espresso のドライバーと images・inspector のプラグイン、browser は gecko・chromium と同じ2つのプラグインです。reset は入れたドライバーとプラグインをすべて消します。
Android(UiAutomator2)で要るもの
UiAutomator2 Driver の公式の文書(Getting Started)にある要件です。
- ホストの OS は macOS・Windows・Linux
- JDK を入れて
JAVA_HOMEを設定する。Android 11(API 30)以降の SDK には JDK 9 以降が要る - Android SDK(SDK Platform・Build-Tools・Platform-Tools)を Android Studio か sdkmanager で入れ、
ANDROID_HOMEを設定する - 端末は、ドライバー 6.0.0 以降では Android 8(API 26)以降
- エミュレーターなら AVD を1つ以上作る。実機なら USB かワイヤレスのデバッグを有効にし、
adb devicesでonlineと出ることを確かめる
iOS(XCUITest)で要るもの
XCUITest Driver の公式の要件のページでは、ホストは macOS が前提(Windows・Linux は限られた対応で、別のガイドがある)で、Xcode と Appium が要ると書かれています。実機は追加の手作業の設定が要り(Real Device Setup のガイド)、ドライバーが端末に WebDriverAgent(WDA)を入れて動かします。Web やハイブリッドの WebView は、デバッグできる設定になっている必要があります。
Espresso と UiAutomator2 の違い
Espresso Driver の公式の README では、UiAutomator2 を「ブラックボックス」、Espresso を「グレーボックス」の枠組みと説明しています。Espresso は画面に出ていない要素を見つけたり、View Tag で要素を探したりできる一方、操作はテスト対象のアプリの中が中心で、アプリの外の操作は一部だけです。テスト対象のアプリは難読化(ProGuard)を切ったもので、Espresso のサーバーと同じ署名である必要があります(Appium がセッション作成のときに自動で署名します)。
appium driver doctorで足りないものを調べる
この節では、ドライバーに付いている点検のコマンドと、その出力の読み方が分かります。
UiAutomator2 Driver の文書は、要件のほとんどを appium driver doctor uiautomator2 で点検できると案内しています。Android の SDK も JDK も無い状態で動かした出力です。
$ appium driver doctor uiautomator2
Running 7 doctor checks for the "uiautomator2" driver
info Doctor ### Starting doctor diagnostics ###
WARN Doctor ✖ ANDROID_HOME environment variable is NOT set!
WARN Doctor ✖ adb, emulator could not be found because ANDROID_HOME is NOT set!
WARN Doctor ✖ JAVA_HOME environment variable is NOT set!
WARN Doctor ✖ $JAVA_HOME environment variable must be set
WARN Doctor ✖ bundletool.jar cannot be found
info Doctor ✔ ffmpeg exists at '/usr/local/bin/ffmpeg'
WARN Doctor ✖ gst-launch-1.0 and/or gst-inspect-1.0 cannot be found
info Doctor ### Diagnostic completed, 4 required fixes needed, 2 optional fixes possible. ###
...
Error: ✖ Treatment required
7つの点検のうち、必ず直すもの(required)が4つ、任意のもの(optional)が2つと数えられています。出力の後半には、項目ごとの直し方が続きます。
| 出た項目 | 種類 | 直し方(出力の案内) |
|---|---|---|
| ANDROID_HOME environment variable is NOT set! | 必須 | Android SDK を入れ、Appium を動かすプロセスに ANDROID_HOME を渡す |
| adb, emulator could not be found | 必須 | ANDROID_HOME を設定すると、その下の adb・emulator が探される |
| JAVA_HOME environment variable is NOT set! | 必須 | JDK を入れ、JAVA_HOME に JDK のフォルダを設定する |
| bundletool.jar cannot be found | 任意 | Android App Bundle(aab)を扱うときに使う。PATH のどこかに置く |
| gst-launch-1.0 … cannot be found | 任意 | 端末の画面の配信に使う GStreamer。使わないなら後回し |
環境変数は「Appium のサーバーを動かすプロセス」に見えている必要があります。ターミナルで設定したあとに別の画面から起動したサーバーや、IDE から起動したサーバーでは値が渡っていないことがあります。doctor はサーバーを起動するのと同じシェルで動かします。
XCUITest Driver も appium driver doctor xcuitest で点検できると公式の要件のページに書かれています。
Appiumサーバーの起動とオプション・設定ファイル
この節では、サーバーの起動のしかた、/status での確かめ方、よく使うオプションと設定ファイルの書き方が分かります。
appium(または appium server)で起動します。Appium 4.0.1 の既定の待ち受けのアドレスは 0.0.0.0(--show-config の defaults で確かめました)なので、同じネットワークのほかの機械からも届きます。自分の PC だけで使うなら --address 127.0.0.1 を付けます。
$ appium --address 127.0.0.1 --port 4723 --log-no-colors
[Appium] Welcome to Appium v4.0.1
[Appium] Non-default server args:
[Appium] { address: '127.0.0.1', logNoColors: true }
[HTTP] Appium REST http interface listener started on http://127.0.0.1:4723
[Appium] No drivers have been installed in ~/.appium. Use the "appium driver" command to install the one(s) you want to use.
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
起動したら、別のターミナルから /status を見ます。
$ curl http://127.0.0.1:4723/status
{"value":{"ready":true,"message":"The server is ready to accept new connections","build":{"version":"4.0.1"}}}
Appium 1 の書き方の /wd/hub/status は、既定の設定では 404 になります。
$ curl -w '\n%{http_code}\n' http://127.0.0.1:4723/wd/hub/status
{"value":{"error":"unknown command","message":"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.","stacktrace":"..."}}
404
以前のテストのコードが /wd/hub を付けていて書き換えられないときは、README の例のとおり --base-path /wd/hub を付けて起動すると同じ URL で受けられます。
よく使うサーバーのオプション
| オプション | 意味(appium server --help) | 既定値 |
|---|---|---|
--address・-a | 待ち受けるアドレス | 0.0.0.0 |
--port・-p | 待ち受けるポート | 4723 |
--base-path・-pa | すべての WebDriver の道筋の前に付ける接頭辞 | (なし) |
--use-drivers | 有効にするドライバー。既定は入っているものすべて | すべて |
--use-plugins | 有効にするプラグイン | (なし) |
--log・-g | ログをファイルにも書く | (なし) |
--log-level | ログの細かさ | info |
--default-capabilities | どのセッションにも付ける既定の capabilities(JSON か JSON のファイル) | (なし) |
--allow-insecure・--deny-insecure | ドライバーが決める「安全でない機能」の許可と禁止 | (なし) |
--config | 設定ファイルの場所 | (自動で探す) |
設定ファイル(.appiumrc.json)
毎回同じオプションを付けるなら、設定ファイルにまとめます。作業するフォルダに .appiumrc.json を置いて --show-config で読み込まれたかを見た結果です。
{
"server": {
"address": "127.0.0.1",
"port": 4730,
"use-plugins": ["inspector"],
"log-level": "info"
}
}
$ appium --show-config
...
from config file at ~/project/.appiumrc.json:
{
server: {
address: '127.0.0.1',
port: 4730,
usePlugins: [ 'inspector' ],
loglevel: 'info'
}
}
項目の名前を書き間違えると、どこが違うかを示して起動が止まります。port を prot と書いたときの原文です。
Error: Errors in config file ~/project/bad.json:
ADDITIONAL PROPERTY must NOT have additional properties
> 1 | {"server":{"prot":4730}}
| ^^^^^^ prot is not expected to be here!
capabilitiesの書き方|appium:の接頭辞と必須の項目
この節では、セッションを作るときに渡す capabilities の形と、書き間違えたときに返るエラーの原文が分かります。
capabilities は「どのプラットフォームの、どのアプリを、どのドライバーで動かすか」を伝える JSON です。UiAutomator2 Driver の文書にある最小の例は次の形で、最初につながった実機でセッションを始めます。
{
"platformName": "Android",
"appium:automationName": "UiAutomator2"
}
よく使う項目です。platformName は W3C の標準の項目なので接頭辞が付かず、それ以外の Appium の項目には appium: が付きます。
| 項目 | 意味 | 例 |
|---|---|---|
platformName | プラットフォーム(必須) | Android、iOS |
appium:automationName | 使うドライバー(4.0.1 では必須) | UiAutomator2、XCUITest、Espresso |
appium:app | 入れて動かすアプリのファイルか URL | /path/to/app.apk |
appium:deviceName | 端末の名前 | Android Emulator、iPhone 16 |
appium:udid | どの端末かを決める識別子 | adb devices に出る値 |
appium:platformVersion | OS の版 | 18.0 |
appium:noReset | セッションの前にアプリの状態を消さない | true |
appium:newCommandTimeout | 命令が来ないまま待つ秒数 | 120 |
書き間違えたときのエラー(実際の応答)
127.0.0.1 の Appium 4.0.1 に curl で POST /session を送り、返った value.error と value.message です。
$ curl -X POST -H 'Content-Type: application/json' \
-d '{"capabilities":{"alwaysMatch":{"platformName":"Android","automationName":"UiAutomator2"}}}' \
http://127.0.0.1:4723/session
| 送ったもの | HTTP | 返った message(原文) |
|---|---|---|
automationName に appium: が無い | 400 | All non-standard capabilities should have a vendor prefix. The following capabilities did not have one: automationName |
| platformName が無い | 400 | 'platformName' is required to be present |
| automationName が無い | 400 | 'automationName' is required to be present |
| JSONWP の形(desiredCapabilities だけ) | 400 | Session capabilities format must comply to the W3C standard. Make sure your client is up to date. |
| ドライバーが入っていない | 500 | Could not find a driver for automationName 'UiAutomator2' and platformName 'Android'. Have you installed a driver that supports those capabilities? |
400 のエラーは送った形の問題、500 の「Could not find a driver」はサーバーの側にドライバーが無い問題です。automationName の値は、ドライバーを入れたときに出た automationName: UiAutomator2 と同じ名前にします。Python のクライアントは UIAutomator2 と送りましたが、同じドライバーが選ばれました。
Appium 1 の書き方のまま送る
desiredCapabilities に automationName などを接頭辞なしで並べる手で JSON を書くときは capabilities.alwaysMatch の中に、platformName 以外は appium: 付きで書く
サーバーを誰でも届く形で開いたままにする
--relaxed-security まで付けて起動する--address 127.0.0.1。安全でない機能は --allow-insecure で必要な名前だけ許すヘルプには、relaxed-security は信頼できるネットワークのクライアントだけのときに使う、とある
Appium Inspectorの使い方|デスクトップ版とプラグイン
この節では、Appium Inspector の入手のしかた、Appium 4 での起動のしかた、版の対応が分かります。
Appium Inspector は、公式の文書で「a GUI assistant tool for Appium, providing visual inspection of the application under test」と説明されている GUI です。スクリーンショットとページソースの表示、要素の検索と操作、ドライバーの命令の実行、操作の記録ができます。
デスクトップ版
GitHub の appium-inspector のリリースから入手。Windows・macOS・Linux(x64・arm64)。
更新の確認ができる .exe・.dmg・.AppImage が推奨
プラグイン版
Appium サーバーに入れ、ブラウザで /inspector を開く。
Appium 4 では 2026.11.6 以降
Web 版
以前の inspector.appiumpro.com は、今は Appium チームと関係がないと公式の文書にある。
デスクトップ版かプラグイン版を使う
プラグイン版を Appium 4 で動かす
公式の Getting Started の手順は、Appium 3 以降では appium plugin install inspector、Appium 4 ではプラグインを有効にして起動し(細かなオプションは公式の手順のとおり)、http://127.0.0.1:4723/inspector を開く形です(ベースパスに関係なく /inspector)。実際に入れて、まず --use-plugins=inspector だけで起動した出力です。
$ appium plugin install inspector
✔ Installing 'inspector'
✔ Validating 'inspector'
ℹ Plugin [email protected] successfully installed
$ appium --address 127.0.0.1 --use-plugins=inspector --log-no-colors
[Appium] Available drivers:
[Appium] - [email protected] (automationName 'UiAutomator2')
[Appium] Available plugins:
[Appium] - [email protected] (ACTIVE)
$ curl -o /dev/null -w '%{http_code}\n' http://127.0.0.1:4723/inspector
200
ブラウザからの接続の扱いなど、起動のオプションは版で変わるため、公式の Inspector の Getting Started で確かめてから足します。サーバーは 127.0.0.1 で待ち受け、使い終わったら止めます。
| Appium の版 | プラグイン版 | デスクトップ版が対応する版 |
|---|---|---|
| Appium 4 | 2026.11.6 以降 | 2026.11.5 以降 |
| Appium 3 | 2025.3.1 以降 | 2025.3.1 以降 |
| Appium 2 | 2025.3.1〜2025.7.3(--source=npm で版を指定) | 2021.8.5 以降 |
デスクトップ版の Linux の起動は、公式の文書では AppImage に実行の権限を付けて動かす形です(chmod a+x のあと ./Appium-Inspector-<version>-linux-<arch>.AppImage)。Windows では WinGet(winget install AppiumDevelopers.AppiumInspector)も紹介されていますが、これはコミュニティが保守しているものと書かれています。
Inspector では、つなぐ先のサーバー(ホスト・ポート)と capabilities を入れてセッションを始め、公式の説明どおり、スクリーンショットとページソースを見ながら要素を探して操作できます。テストのコードに写す前に、ここで探し方が1つの要素に決まるかを確かめます。
Python・Javaのクライアントで最初のテストを書く
この節では、公式のクライアントの入れ方と、セッションを作る最小のコード、手元のサーバーにつないだときの出力が分かります。
Python(Appium-Python-Client)
公式の README の対応表では、6.0.0 以降は Selenium の Python バインディング 4.37.0 以降、Python 3.10 以降です(6.1.8 のパッケージ情報は Requires-Python >=3.10、selenium >=4.51.0, <5.0)。
pip install Appium-Python-Client
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
options = UiAutomator2Options()
options.platform_name = "Android"
options.device_name = "Android Emulator"
options.app = "/path/to/app.apk"
print(options.to_capabilities())
driver = webdriver.Remote("http://127.0.0.1:4723", options=options)
try:
el = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="item")
el.click()
finally:
driver.quit()
Android の SDK が無いホストの Appium 4.0.1 につないだときの出力です。前半が組み立てた capabilities、後半がサーバーから返ったエラーです。
{'automationName': 'UIAutomator2', 'platformName': 'Android', 'appium:deviceName': 'Android Emulator', 'appium:app': '/path/to/app.apk'}
WebDriverException
Message: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details
to_capabilities() の表示では automationName に接頭辞がありませんが、サーバーのログには "appium:automationName":"UIAutomator2" と届いていました。クライアントが送るときに appium: を付けるので、Options を使えば自分で付けずに済みます。ここまで来ればドライバーまでは届いているので、あとは前の節の doctor の項目を埋めます。
README の例は pytest のフィクスチャーでサーバーとドライバーを用意し、with でセッションを閉じる形です。pytest の書き方は、関連記事「pytest 使い方|導入からfixture・mock・カバレッジまで実行結果つき」で扱っています。
Java(java-client)
公式の java-client の README にある依存の書き方と、最小のコードの形です(2026年11月26日時点の README の最新は 11.0.0)。
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>11.0.0</version>
<scope>test</scope>
</dependency>
UiAutomator2Options options = new UiAutomator2Options()
.setUdid("123456")
.setApp("/home/myapp.apk");
AndroidDriver driver = new AndroidDriver(
new URI("http://127.0.0.1:4723").toURL(), options
);
try {
WebElement el = driver.findElement(AppiumBy.xpath("//Button"));
el.click();
driver.getPageSource();
} finally {
driver.quit();
}
README のコメントにあるとおり、Appium 1 の既定の URL は http://127.0.0.1:4723/wd/hub でしたが、今は /wd/hub を付けません。
Appiumの要素の探し方(ロケーター)早見表
この節では、Appium で要素を探すときの方法の名前と、どの OS・ドライバーで使うかが分かります。
Python のクライアントの AppiumBy(6.1.8)にある主な探し方です。右の列は WebDriver の命令で送られる文字列です。
| AppiumBy の名前 | 送られる文字列 | 使いどころ |
|---|---|---|
| ACCESSIBILITY_ID | accessibility id | アプリの側で付けたアクセシビリティの識別子で探す。両方の OS で同じ書き方にしやすい |
| ID(Selenium の By.ID) | id | 要素の id で探す |
| XPATH(By.XPATH) | xpath | ページソースの構造で探す。画面が変わると壊れやすい |
| ANDROID_UIAUTOMATOR | -android uiautomator | UiAutomator2 で UiSelector の式を使う |
| ANDROID_VIEWTAG | -android viewtag | Espresso の View Tag |
| IOS_PREDICATE | -ios predicate string | XCUITest の述語の式 |
| IOS_CLASS_CHAIN | -ios class chain | XCUITest のクラスの連なりで探す |
| IMAGE | -image | 画像で探す |
探し方は、アプリの側で accessibility id を付けてもらい、それで探すのが両方の OS で同じテストを書きやすい形です。XPath はページソースの階層に依存するので、画面の作りが変わると直す箇所が増えます。待ち方(要素が出るまで待つ)は Selenium と同じ WebDriverWait の考え方が使えます。要素の探し方と待ち方の全体は、関連記事「Selenium Pythonの使い方|要素取得の全パターンと待機処理」で扱っています。
- 1accessibility idアプリの側で両方の OS に同じ値を付けてもらえれば、同じコードで探せる
- 2id開発者が付けた id。OS ごとに値が違うことがある
- 3OS ごとの式(-android uiautomator・-ios predicate string)文字や属性の組み合わせで探す。OS ごとに書き分ける
- 4XPathほかで決まらないときに。Inspector で1つに決まるかを確かめてから使う
AppiumとSelenium・Playwrightの違い
この節では、名前の似たテスト自動化のツールと Appium の対象の違いが分かります。
3つとも画面の操作を自動化しますが、対象とつなぎ方が違います。比べているのは各公式の文書にある対象と仕組みで、どれが上という話ではありません。
| 項目 | Appium | Selenium | Playwright |
|---|---|---|---|
| 主な対象 | モバイルのアプリ(ネイティブ・ハイブリッド)とモバイルの Web、デスクトップのアプリ | ブラウザ | ブラウザ |
| つなぎ方 | WebDriver の形で Appium サーバーへ送り、サーバーが capabilities に合うドライバーを選ぶ | WebDriver の形でブラウザのドライバーへ送る | Playwright のライブラリがブラウザを起動して操作する |
| 端末の用意 | Android の実機・エミュレーター、iOS の実機・シミュレーターと、それぞれの SDK | ブラウザ | ブラウザ |
Appium の Python クライアントは Selenium の Python バインディングの上に作られているので、Selenium の書き方を知っていれば、要素の操作や待ち方はほぼ同じです。ブラウザだけのテストなら、関連記事「Playwright入門|E2Eテストの書き方とCI実行まで実行結果つきで解説」で扱っています。
Appiumでよくあるエラーと直し方(原文つき)
この節では、インストールからセッション作成までに出やすいエラーの原文と、原因と直し方が分かります。
原文はすべて Appium 4.0.1 で実際に出たものです(長い stacktrace は省いています)。
| 出た文(原文) | 場面 | 原因と直し方 |
|---|---|---|
| Could not find a driver for automationName 'UiAutomator2' and platformName 'Android'. Have you installed a driver that supports those capabilities? | セッション作成(500) | ドライバーが入っていない。appium driver install uiautomator2。別の APPIUM_HOME のサーバーにつないでいないかも見る |
| Could not load the driver 'uiautomator2' because it is not installed. You don't have any drivers installed yet. | 起動(--use-drivers) | 指定したドライバーが入っていない。入れるか、--use-drivers を外す |
| Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. | セッション作成 | Android SDK の場所が渡っていない。SDK を入れて ANDROID_HOME を設定し、サーバーを起動し直す |
| All non-standard capabilities should have a vendor prefix. | セッション作成(400) | Appium の項目に appium: が無い。Options を使うか、手で付ける |
| 'automationName' is required to be present | セッション作成(400) | appium:automationName を書く |
| Session capabilities format must comply to the W3C standard. Make sure your client is up to date. | セッション作成(400) | Appium 1 の形(desiredCapabilities)。クライアントを今の版にする |
| Could not start REST http interface listener. The requested port may already be in use. … listen EADDRINUSE: address already in use 127.0.0.1:4723 | 起動 | 同じポートでもう1つ動いている。前のサーバーを止めるか --port を変える |
| [ERROR] Unrecognized arguments: --allow-cors | 起動 | Appium 4 に無いオプション。Inspector の起動のしかたは公式の Getting Started を確かめる |
| A driver named "uiautomator2" is already installed. Did you mean to update? | driver install | 入れ直しではなく appium driver update uiautomator2 |
| Could not resolve driver; are you sure it's in the list of supported drivers? | driver install | 名前の書き間違い(例:uiautomator)。appium driver list の名前で入れる |
| The requested resource could not be found …(404) | /wd/hub/status など | URL に Appium 1 の /wd/hub が付いている。外すか --base-path /wd/hub で起動 |
ポートがふさがっているときは、どのプロセスが使っているかを確かめ、自分が起動した Appium だけをプロセスの番号(PID)で止めます。
$ ss -ltnp | grep 4723
$ kill <PID>
止まったときのログはこう出ます。
[Appium] Received SIGTERM - shutting down
[HTTP] Closing Appium HTTP server
[HTTP] Appium HTTP server has been successfully closed after 0ms
つまずきを、手順の順に点検できるように並べました。
- 1Node.js の版が engines の範囲にあるAppium 4.0.1 は ^22.22.2・^24.15.0・26 以上。node -v で確かめる
- 2ドライバーが入っていて、版が Appium 4 に合うappium driver list --installed。UiAutomator2 は 9.0.0 以降、XCUITest は 13.0.0 以降
- 3doctor の必須の項目がすべて ✔ANDROID_HOME・JAVA_HOME はサーバーを起動するシェルで設定する
- 4/status が ready:true を返すURL に /wd/hub を付けない。ポートとアドレスはクライアントと同じ
- 5capabilities に platformName と appium:automationName端末は adb devices で online(Android)か、実機の設定のガイドどおり(iOS)
Appiumを使うか決める判断表
この節では、やりたいことに対して Appium と、どのドライバーやほかの方法が合うかが分かります。
| やりたいこと | 合う選び方 | 理由 |
|---|---|---|
| Android と iOS のアプリを同じ言語・同じ形でテストしたい | Appium(UiAutomator2+XCUITest) | どちらも WebDriver の形で、クライアントのコードをそろえられる |
| Android で、アプリの外の画面も含めて操作したい | Appium の UiAutomator2 | ブラックボックスで、端末の画面全体を扱う |
| Android のアプリの中を細かく、画面に出ていない要素も扱いたい | Appium の Espresso | グレーボックスで、アプリの中から操作する。アプリの外は一部だけ |
| iOS のアプリを Windows・Linux だけでテストしたい | XCUITest の公式の Non-macOS Hosts のガイドを先に読む | 公式の要件は macOS が前提で、ほかの OS は限られた対応 |
| Web サイトをパソコンのブラウザでテストしたい | Selenium か Playwright | アプリの自動化の仕組みは要らない |
| 手元に端末をそろえずに多くの機種で試したい | Appium に対応したクラウドのサービス(各事業者の説明を確かめる) | README にも、手元でもクラウドでも動かせるとある |
| Swift・Kotlin のテストを Xcode・Android Studio の中だけで回したい | XCUITest・Espresso をそのまま使う | 言語と道具がそれぞれの開発環境にそろう |
Appiumのよくある質問
この節では、Appium について検索の多い疑問への短い答えが分かります。
Q. Appium は無料ですか?
Appium 本体は Apache-2.0 のオープンソースで、本体・公式のドライバー・公式のクライアントは npm や pip などから入れられます。クラウドの端末のサービスを使う場合は、その事業者の料金の説明を確かめます。
Q. Appium の最新バージョンはいくつですか?
2026年11月26日時点で 4.0.1(npm の公開日は2026年11月23日)です。公式の README には、Appium チームは最新の版だけをサポートするとあります。
Q. Appium をインストールしたのに何も操作できません。
README のとおり、本体だけでは何も自動化できません。appium driver install uiautomator2(Android)や xcuitest(iOS)でドライバーを入れます。入ったかは appium driver list --installed で確かめます。
Q. Windows で iPhone のアプリをテストできますか?
XCUITest Driver の公式の要件では、ホストは macOS が前提で、Windows・Linux は限られた対応(Non-macOS Hosts のガイド)とされています。Android のテストは Windows・macOS・Linux のどれでもできます。
Q. Appium Desktop はまだ使えますか?
今の公式の文書が案内している GUI は Appium Inspector(デスクトップ版とプラグイン版)です。サーバーは npm i -g appium で入れたものをコマンドで起動します。
Q. URL の /wd/hub は付けますか?
Appium 2 以降の既定では付けません。http://127.0.0.1:4723 につなぎます。付けたままだと 404 の「unknown command」が返ります。以前のコードを変えられないときは --base-path /wd/hub で起動します。
Q. desiredCapabilities と capabilities は何が違いますか?
desiredCapabilities は Appium 1 のころの形で、Appium 4.0.1 に送ると「Session capabilities format must comply to the W3C standard」で断られました。今のクライアントの Options を使うと W3C の形(capabilities.alwaysMatch と appium: の接頭辞)で送られます。
Q. UiAutomator2 と Espresso はどちらを使えばよいですか?
アプリの外の画面も含めて端末全体を扱うなら UiAutomator2、アプリの中を細かく扱いたいなら Espresso です。Espresso は難読化を切ったアプリと、署名をそろえる条件があります(Espresso Driver の README)。
Q. Appium 3 から 4 に上げるときに何を見ればよいですか?
Node.js の版(^22.22.2・^24.15.0・26 以上)、ドライバーとプラグインの版(UiAutomator2 9.0.0 以降、XCUITest 13.0.0 以降、Inspector プラグイン 2026.11.6 以降)、起動のオプション(--allow-cors は無い)です。くわしくは公式の移行ガイド「Migrating to Appium 4」を見ます。
Q. テストのコードはどの言語で書けますか?
公式のクライアントは Java・Python・Ruby・.NET C# で、ほかの言語はサードパーティのクライアントがあると README にあります。WebDriver に対応した言語なら書けます。
Q. Appium のサーバーは自動で起動できますか?
Python のクライアントには AppiumService があり、README の例では pytest のフィクスチャーで --address 127.0.0.1 -p 4723 を付けて起動し、テストのあとに止めています。
まとめ|Appiumとは・始め方
この節では、Appium を始めるときに押さえる5点が分かります。
- Appium は、Android・iOS などのアプリを WebDriver の形で自動操作するオープンソースのツール(Apache-2.0)。2026年11月26日時点の最新は 4.0.1。
- 本体は
npm i -g appium(Node.js ^22.22.2・^24.15.0・26 以上)。本体だけでは動かず、appium driver install uiautomator2・xcuitestでドライバーを入れる。 appium driver doctorで ANDROID_HOME・JAVA_HOME などの足りないものを先に埋める。iOS は macOS と Xcode が前提。- サーバーは手元なら
--address 127.0.0.1で起動し、/statusで確かめる。URL に/wd/hubは付けない。 - capabilities は
platformNameとappium:automationName。エラーの 400 は送った形、500 の「Could not find a driver」はドライバーの不足と読む。
参考・出典
- Appium Documentation:https://appium.io/docs/en/latest/
- Appium の README(npm の appium パッケージ 4.0.1 に同梱):https://www.npmjs.com/package/appium
- Migrating to Appium 4:https://appium.io/docs/en/latest/guides/migrating-3-to-4/
- Appium の Extension CLI:https://appium.io/docs/en/latest/cli/extensions/
- Appium Ecosystem(Drivers・Clients・Plugins):https://appium.io/docs/en/latest/ecosystem/
- UiAutomator2 Driver Getting Started:https://appium.github.io/appium-uiautomator2-driver/latest/getting-started/
- UiAutomator2 Driver の変更履歴:https://github.com/appium/appium-uiautomator2-driver/blob/master/CHANGELOG.md
- XCUITest Driver System Requirements:https://appium.github.io/appium-xcuitest-driver/latest/getting-started/system-requirements/
- Espresso Driver:https://github.com/appium/appium-espresso-driver
- Appium Inspector Overview:https://appium.github.io/appium-inspector/latest/overview/
- Appium Inspector Getting Started:https://appium.github.io/appium-inspector/latest/getting-started/
- Appium Python Client:https://github.com/appium/python-client
- Appium java-client:https://github.com/appium/java-client
- W3C WebDriver:https://www.w3.org/TR/webdriver/
(確認日 2026年11月26日)
本記事の内容は、ご自由にお使いください。
ご利用の際は、出典として本ページへのリンクを記載いただけますようお願いします。
(記載例)出典:株式会社RJC「Appiumとは|スマホテスト自動化の始め方とドライバーの入れ方【Appium 4】」
株式会社RJC ― SI事業・SES事業・AI駆動開発。RJCは一緒に成長を楽しめる会社です。
WE ARE HIRING
RJCで一緒に開発しながら、
成長を楽しみませんか?
RJCは、Web・モバイル・AIを活用した開発プロジェクトで、テックリードやPM・PMOも活躍するシステム開発会社です。会社を知る、待遇を確かめる、話を聞いてみる。気になるところ見てみてください!
- 127日年間休日
- 12時間平均残業時間
- 毎日ガチャ遊びココロも大切にする福利厚生。アマギフなどの賞品ラインナップ!
ほかにも、チケットレストラン、書籍読み放題、2年ごとの慰労報奨(休暇 or 金一封)、11期連続の黒字決算。