This article explains the manual setup instructions for Mobile Automation, which is not required anymore. A simplified zero-setup is explained here, available from ACCELQ Release 5.1.
Android Environment Setup
Here are the software components you need on the local machine.
- Install Java and set environmental variable, JAVA_HOME
- Install Appium: Click here for instructions
- Install Android Platform Tools: Instructions below
- Connect device and enable USB debugging: Instructions below
Setting up Android Platform Tools
- Go to https://developer.android.com/studio
- Click Download options
-
Scroll down to Command line tools only and download os specific package
-
Extract the package, rename the folder as tools and place it as below
-
For Windows place in - c:/Android/ such that it appears as c:/Android/tools
-
For Linux or Mac - /Users/<username>/Android/ such that it appears as /Users/<username>/Android/tools
-
-
Set Environmental variable ANDROID_HOME
-
For Windows, ANDROID_HOME as c:/Android
-
For Linux or Mac, ANDROID_HOME as /Users/<username>/Android
-
-
Add ANDROID_HOME/tools/bin to PATH variable.
Note: For Linux or Mac, run below command. Replace ANDROID_HOME with correct location pathsudo launchctl config user path $PATH:<ANDROID_HOME>/tools/bin
- Execute below command
For Windowssdkmanager --help
For Linux or Mac./sdkmanager --help
Commands for Windows and Linux or Mac are same. We need to include ./ for Linux or Mac - If the above command prints something, it means, so far our setup is good. In case of errors, check above steps again.
-
Install required tools with below command
Note: Replace <ANDROID_HOME> with correct location path
sdkmanager --install "platform-tools" "platforms;android-29" "build-tools;29.0.2" --sdk_root="<ANDROID_HOME>"
-
Add <ANDROID_HOME>/platform-tools to PATH variable.
Note: For Linux or Mac, run below command. Replace ANDROID_HOME with correct location pathsudo launchctl config user path $PATH:<ANDROID_HOME>/platform-tools
-
Open a new terminal or command prompt and check if below command is working
adb --help
Setting up Physical Android Device
-
Connect your physical device with USB cable
- We need to enable Developer Mode if not enabled.
- Go to Settings app
- Search for About Phone and Click it
-
Tap the Build number seven times until it says Now, You are a developer
-
In the Settings app, Search for Developer Options.
-
Check Enable USB Debugging checkbox.
-
In the PC, open a terminal and execute command "adb devices"
-
If connected device shows up in the output, we are ready for Automation.
iOS Environment Setup
Here is the list of things we need for iOS automation
- Machine with MacOs
- Install Appium: Click here for instructions
- Install Xcode software
- Apple Developer Membership (optional)
Once Xcode software is installed on the mac machine, we need to install Appium's Driver agent app on target device. This can be done in Automated way or Manual Way.
Automation Method
Create a driver profile with below JSON with correct details.
{
"xcodeOrgId": "<Team ID>",
"xcodeSigningId": "Apple Development"
}
During view capture or Executing a run, select this driver profile.
When we provide these details, Appium tries to sign their driver agent app with given details. If this fails, we need to sign and install the app manually.
Manual Method
Download this zip. Unzip and open WebDriverAgent.xcodeproj file with Xcode.
As shown in the above screenshot, click on WebDriverAgent Project. Then, we shall see Targets (second box).
In the targets, we need WebDriverAgentLib and WebDriverAgentRunner. Click on each target and then Click Signing & Capabilities. Select your Team and Sign the App. If you haven't logged in, Login with your developer account. If your account is free, you need to create a provisional profile after login.
If the error says existing bundle id, we need to change the bundle ID for both the targets. In each target, go to build settings and search for bundle identifier and change it to unique bundle ID.
Till here, This is one time setup.
Now, open a terminal in this folder and run below command. First time execution of below command takes some time. Next time, it takes 5-10 secs.
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<UDID>' test -allowProvisioningUpdates
replace <UDID> with your connected iOS device UDID. UDID can be obtained by below command.
instruments -s devices
If the log ends as shown as below, Appium's agent is ready.
If the log ends with an error saying 'Permissions required'. On the iOS device, Go to Settings, General, Device Management, select the account, and Click Trust Developer. Now, re-run the same Xcode command.
For a more detailed technical explanation, refer to this article.
Comments
0 comments
Please sign in to leave a comment.