Appium CLI — Creating an Appium Config File in “JSON” format(Step-by-Step) & With Field-by-Field Explanation

Get a step-by-step walkthrough in the video below!
What is Appium configuration file?
— Used to simplify running Appium server with predefined settings.
This file allows you to configure server arguments like ports, drivers, plugins, and log settings in one place.
πΉ Step 1: Understand the Appium Config File Purpose
Appium config files let you:
- Predefine server settings like port, host, base-path
- Set drivers and plugins
- Define log level and log file
- Avoid passing long command-line arguments
πΉ Step 2: Choose a File Format
Appium supports:
- JSON (preferred)
- YAML (also supported)
- Js(javascript)
Use .json for cross-platform consistency.
πΉ Step 3: Create a JSON Config File
Create a file named appium-config.json.
https://github.com/AppiumGuide/AppiumGuide/blob/main/config_files/appium-config.json

Step-by-Step Breakdown of “appium-config.json” file:
πΉ Step 1: Root Structure
The config file is divided into 3 major sections:
- “server” — Appium server settings
- “driver” — Mobile automation drivers (e.g., uiautomator2, xcuitest)
- “plugin” — Appium plugins to enhance functionality
πΉ Step 2: “server” Block
"server": {
"port": 4723,
"host": "0.0.0.0",
"basePath": "/wd/hub",
"logLevel": "info",
"logFile": "./logs/appium.log",
"relaxedSecurityEnabled": true,
"allowCors": true,
"useDrivers": ["uiautomator2", "xcuitest"],
"usePlugins": ["element-wait"]
}
πΈ Field-by-Field Explanation:
Key → Purpose
port → Port where Appium server will listen (default: 4723)
host → Host address (0.0.0.0 means listen on all interfaces)
basePath → WebDriver URL path (/ is standard)
logLevel → Verbosity of logs (info, debug, warn, etc.)
logFile → Path to store server logs (./logs/appium.log)
relaxedSecurityEnabled → Allows unsafe features like file upload, shell access (for advanced usage)
allowCors → Enables cross-origin requests for Appium server UI
useDrivers → Preloads the listed drivers at startup (Android & iOS)
usePlugins → Preloads plugins, here element-wait is activated
πΉ Step 3: “driver” Block
"driver": {
"uiautomator2": {
"version": "latest"
},
"xcuitest": {
"version": "latest"
}
}
πΈ Purpose:
Defines which versions of the mobile drivers to load.
πΉ Step 4: “plugins” Block
"plugin": {
"images": {
"active": true
}
}
πΈ Purpose:
Activates Appium plugins for enhanced functionality.
πΉ Step 5: Running with This Config
Once saved, start Appium with:
appium --config \path\appium-config.json

Example:
Compare the values between appium logs Vs appium-config.json

GitHub Link:
π¬ Explore More! Watch My Latest Videos on YouTube!
Visit My Official Blog:
No comments:
Post a Comment