For Mobile Automation (Android & iOS)
# 1. Install JDK 17
brew install openjdk@17
# 2. Set JAVA_HOME (temporary session)
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
# 3. Make permanent (add to ~/.zshrc or ~/.bashrc)
echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc
echo 'export PATH="$JAVA_HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# 4. Verify installation
java -version
echo $JAVA_HOME
You can check the location of your existing Java version by running the where
command in Command Prompt.
# 1. Download & Install Temurin JDK 17
Invoke-WebRequest -Uri "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8%2B7/OpenJDK17U-jdk_x64_windows_hotspot_17.0.8_7.msi" -OutFile jdk17.msi
Start-Process msiexec.exe -ArgumentList '/i jdk17.msi /quiet' -Wait
# 2. Set JAVA_HOME for Current Session (TEMPORARY)
$env:JAVA_HOME = "C:\Program Files\Eclipse Adoptium\jdk-17.0.8.7-hotspot"
$env:Path += ";$env:JAVA_HOME\bin"
# 3. Make Environment Variables Permanent (PERSISTENT)
[System.Environment]::SetEnvironmentVariable('JAVA_HOME', $env:JAVA_HOME, 'Machine')
[System.Environment]::SetEnvironmentVariable('Path', "$([System.Environment]::GetEnvironmentVariable('Path','Machine'));$env:JAVA_HOME\bin", 'Machine')
# 4. Verify That the Correct JAVA_HOME is Set
$javaHome = [System.Environment]::GetEnvironmentVariable('JAVA_HOME', 'Machine')
$path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
Write-Host "JAVA_HOME is set to: $javaHome"
Write-Host "Path contains: $path"
# 5. Verify Java Version
java -version
- IntelliJ IDEA Download: https://www.jetbrains.com/idea/download
brew install node@20
echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
node -v
npm -v
Invoke-WebRequest -Uri "https://nodejs.org/dist/v20.11.1/node-v20.11.1-x64.msi" -OutFile "nodejs.msi"
Start-Process msiexec.exe -ArgumentList "/i nodejs.msi /quiet" -Wait
node -v
npm -v
npm install -g appium
npm install -g appium-doctor
appium -v
Download: https://developer.android.com/studio
- macOS:
/Users/<your-username>/Library/Android/sdk
- Windows:
%LOCALAPPDATA%\Android\Sdk
node nodejs/src/setup.js
This script will:
- Detect your OS (Windows/macOS)
- Set the
ANDROID_HOME
environment variable - Add
platform-tools
to yourPATH
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
setx ANDROID_HOME "%LOCALAPPDATA%\Android\Sdk"
setx PATH "%PATH%;%ANDROID_HOME%\platform-tools"
- Open Android Studio > Device Manager
- Create a new device (e.g., Pixel 6)
- Download system image (e.g., Android 14)
- Click Finish
- Start emulator using play icon
adb devices
Here's your content formatted as Markdown:
Note: You need to close and reopen your IDE after running this script.
You can install the Android Command Line Tools directly (without Android Studio).
Run the following Node.js script to:
- Install Android Command Line Tools
- Set
ANDROID_HOME
- Set up
adb
,emulator
,sdkmanager
- Automatically create and launch an emulator named
iphone
(for both Windows and macOS)
node install_android_cmd.js
For macOS, after the script completes, run: Current meet issue :System UI Not Responding still not found solution when run on mac
chmod +x install_android_cmd_tool_mac.sh && ./install_android_cmd_tool_mac.sh
Then
source ~/.zshrc
After installation, verify that the tools are working by running:
adb devices
echo $ANDROID_HOME
- Appium Inspector: https://github.com/appium/appium-inspector/releases
- UIAutomatorViewer:
$ANDROID_HOME/tools/bin/uiautomatorviewer
Download: https://xcodereleases.com/
xcode-select --install
npm install -g appium-xcuitest-driver
- Xcode → Open Developer Tool → Simulator
- Choose/Create iOS device (e.g., iPhone 14)
xcrun simctl list | egrep '(Booted)'
node nodejs/src/setup.js
This updates hubHost
in android.json
/ ios.json
.
{
"hubHost": "192.168.x.x"
}
Refer in folder grid3/run-grid3.md
Ensure npm install is run inside the nodejs folder: Move to folder
cd nodejs
Then run cmd
npm install
This update to BaseTest
will perform the following:
-
Update
configuration.hubHost
in the following JSON files inside thegrid3
folder:android.json
ios.json
-
Start Grid with the following ports:
- Grid Hub:
4444
- Appium Android Node:
4723
- Appium iOS Node:
4727
- Express Server:
9999
(for real-time logs)
- Grid Hub:
@BeforeSuite
public void startGrid() throws IOException {
// Current not much device can hardcode fix values
// Logic to update configuration.hubHost in android.json and ios.json
// Kill All port 4444,9999,4723,4727
// Start Grid on port 4444
// Start Appium Android node on port 4723
// Start Appium iOS node on port 4727
// Start Express server on port 9999 for real-time logs
}
Run emulator Android
emulator @iphone
On Mac
./mvnw clean test -Dsuites=android-ios
./mvnw clean test -Dsuites=android
On Window
./mvnw.cmd clean test -Dsuites=android