Appium
Appium
Appium Webpage
Appium Library NOTE: Best to navigate using the EN
drop down menu to jump to a section then use the previous
and next
arrows to move within that section. The page with the full menu of direct links are broken :-(
Appium API Documentation
Appium setup/installation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$
* Install nvm, use nvm to manage node versions
* Install specific version of node for appium, list available versions, make required version active for the current shell
nvm list
nvm install 18.18.2
which node
node -v
nvm use v18.18.2
npm install -g npm@10.5.0 <=== sometimes throws errors trying to install pkgs
npm config get prefix
npm list -g
npm i --location=global appium
appium -v
npm install -g appium-doctor
appium driver list
appium driver install chromium
Drivers are installed under ~/.appium/node_modules/
if not available via npm download from heretry using a mirror site by adding the following line to ~/.npmrc
1
chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
Appium Drivers
Install Appium drivers
appium driver install uiautomator2
appium driver install xcuitest
appium driver install mac2
appium driver install safari
appium driver install gecko
APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 appium driver install chromium
APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 appium driver install espresso
npm show uiautomator2 version
Sometimes the loaded chromium web driver is not compatible with an older browser installed on the device either install the correct version - usually reported in the logs or run appium to download it.
1
appium --allow-insecure chromedriver_autodownload
Appium Doctor
Run Appium Doctor
to check health of install, and, use the report to ensure the correct packages/libraries are installed.
1
$ appium-doctor
Appium Capabilities
1
2
3
4
5
6
7
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"appium:deviceName": "cexx17xxxx5330xx03",
"appium:appPackage": "com.trustpower.loop"
}
Appium Inspector
Download Launching appium on MAC may throw an error that its not a trusted app. Locate the App in file browser/finder under /Applications, Use CTRL+Click to open the App. To change which apps can open on your Mac, choose Apple menu > System Settings, click Privacy & Security in the sidebar, then go to Security on the right. Youu can also use the command line;
1
2
sudo xattr -r -d com.apple.quarantine /Applications/Appium Inspector.app
Note you can not have Chrome and Appium inspector debugging together (only one USB cable - obvious)
In Chrome uncheck the tick boxes under to release device. Also adb devices
will report nothing.
Debug / Screen mirror using Chrome
Launch and run Appium Inspector
- Ensure environment variables are set for current shell, add it to
.bashrc
or.zshrc
1
2
3
4
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/
export PATH=${JAVA_HOME}/bin:${PATH}
export ANDROID_HOME=${HOME}/Library/Android/sdk
Ensure you have adb
in your path. Connect android phone over USB to laptop. Check device is detected
1
2
3
4
5
6
$ adb devices
List of devices attached
cexx17xxxx5330xx03 unauthorised <=== authorise from handset under developer settings
$ adb devices
cexx17xxxx5330xx03 device
From this shell start appium
server (pass argument to allow auto download of chromuim as above)
1
$ appium
Appium server will start up on default localhost:4723
Launch Appuim Inspector
using spotlight search CND-SPACE
Within Appium Inspector
create/add desired Capabilities (see above simple example) or with more options
Use SaveAs
to store setup for easy recall/templating for different configurations. Settings are stored under ~/Library/Application Support/appium-inspector/settings.json
.
Click Start Session
, Appium Inspector
should connect to the appuim
server started in the terminal shell, in turn connect to the mobile device and launch the App specified in desired Capabilities. Appium Inspector
should mirror the screen for inspection.