This document discusses Appium troubleshooting, including:
1) Supporting versions and stability challenges with Appium and dependencies like Node.js and npm
2) Setting up the Appium server environment and launching the server manually and programmatically
3) Handling logs, enabling parallel testing on multiple devices or emulators, and tips for native and web apps
2. On The Agenda
Appium Installation & Supporting Versions
Appium Server Launching (manually & programmatically)
Parallel Run
Device Vs Emulators
Log Handling
Native & WebApp Tip
Q&A
3. Install & Run
Challenges
★ Supporting versions & stability
★ Running Appium programmatically
★ Maintaining long stable run
★ Rerun of server (Best Practice)
★ Parallel run on multiple devices
4. Appium - Supporting versions & stability
High sensitivity to supporting versions.
Appium Server Version Node.js npm Appium Java Client
1.5.3 0.12.13 2.15.1 2.0, 3.41, 4.0.0
Install Steps for 1.5.3
npm uninstall npm -g
brew install npm -g
brew install node
npm install appium@1.5.2
npm update appium@1.5.3
5. Appium Server – Environment Setup
In Terminal write “Android” and make sure following components installed:
●
Android SDK Tools
●
Android SDK Platform-Tools
●
Android SDK Build-Tools
Environmental Settings:
#JAVA_HOME
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
export PATH="/usr/local/bin:$PATH"
#ANDROID
export ANDROID_HOME="/usr/local/Cellar/android-sdk"
export ANDROID_SDK=$ANDROID_HOME
6. Appium Server – Run Command & switches
For iOS Run
appium --address 127.0.0.1 --port 4723 --log appiumClientLog.log --session-override
For Android
appium --address 127.0.0.1 --port 4724 --bootstrap 5724 -U 192.168.56.101:5555 --
log appiumDriverLog.log --session-override
appium --address 127.0.0.1 --port 4723 --bootstrap 5723 -U 192.168.56.102:5555 --
log appiumClientLog.log --session-override
7. Appium - Server Arguments
--address 127.0.0.1
Run Appium server on remote or locally
--port 4723 --bootstrap 5723
Port to listen on & (Android-only) port to use on device to talk to Appium
--log appiumClientLog.log
Also send log output to this file
--session-override
Enables session override (clobbering)
8. Appium – Server launching programmatically (logic)
Is Appium Active?
Launch Appium Server
Appium Connect
boolean isAppiumActive = isAppiumActive();
if(!isAppiumActive)
RunAppiumServer();
else
Appium.connect();
9. Appium - Run Server
<< Don't write logs to console (due to slowness & buffer
fill-up)
protected void runAppiumServer() throws ConnectionException, Exception {
try {
StringBuffer runAppiumCommand = new StringBuffer("appium --address " ...
+ " --log appiumClientLog.log --session-override --native-instruments-lib");
if (this instanceof ClientAndroidImpl)
runAppiumCommand.append(" -U " + getTaxiAppium.getUuid());
runAppiumCommand.append(" > /dev/null 2>&1 &");
CliCommand cmd = new CliCommand(runAppiumCommand.toString());
cmd.setTimeout(3000);//default 30sec
cmd.setIgnoreErrors(true);
terminal.handleCliCommand("Run appium server", cmd);
} catch (Exception e) {
report.report("Unable to run Appium - need to stop the run! " + e.getMessage());
throw new SeverFailedToDeployed("failed to run Appium : " + e.getMessage());
}
}
10. Appium – Disable On screen Logs
--log appiumClientLog.log
Also send log output to this file
runAppiumCommand.append(" > /dev/null 2>&1 &");
How to hide terminal output when executing a command?
Add to your server arguments the following:
appium --address 127.0.0.1 --port 4723 --bootstrap 5723 --log appiumClientLog.log --session-override
> /dev/null 2>&1 &
Run server string will look like:
Don't Forget:
11. Appium – Parallel Devices Run Android
--port 4723 --bootstrap 5723
--port 4724 --bootstrap 5724
Android Device 1
Android Device 2
Make Sure to use Different Port Id and BootStrap ID for each device.
For Android Add UUID for real device or IP for simulator:
-U 192.168.56.101:5555
For iOS the bootstrap flag can be dropped BUT still maintain deferent Port ID.
12. Appium - init process takes too long
public DesiredCapabilities setCapabilities() {
...
if (!reset) {
capabilities.setCapability("fullReset", false);
capabilities.setCapability("noReset", true);
}
...
}
Add to capabilities:
In the event that Login (for exmp') shouldn't be tested...
FullReset - Open app with last used screen
NoReset - Do not install app from path if app is already installed.
13. Appium - Scrolling problem
private void swipeDown() throws Exception {
int screenWidth = Integer.valueOf(appiumDriver.manage().window().getSize().width);
int screenHeight = Integer.valueOf(appiumDriver.manage().window().getSize().height);
appiumDriver.swipe((screenWidth / 2), ((int) (screenHeight * 0.8)), (screenWidth / 2), ((int)
(screenHeight * 0.2)), 2000);
}
Swipe What?
public void swipeByElement(GetTaxiButton gettaxiBtn,boolean left) throws Exception {
int ScreenY = findElementYOnScreen(gettaxiBtn);//"+orderTaxiForm.getLine().getName()+"
if (left)
appiumDriver.swipe(Integer.valueOf((int) (appiumDriver.manage().window().getSize().width *
0.2)),ScreenY,Integer.valueOf((int) (appiumDriver.manage().window().getSize().width
*0.8)),ScreenY,2000);
else
appiumDriver.swipe(Integer.valueOf((int) (appiumDriver.manage().window().getSize().width
*0.8)),ScreenY,Integer.valueOf((int) (appiumDriver.manage().window().getSize().width *
0.2)),ScreenY,2000);
}
Speed -> Not to slow not to fast (2000 Good balance)
By screen size for full scroll all the way.
14. Appium – Selenium Trick
// AbstractPage - passing to it the WebDriver
appiumPageImpl= new AppiumDriverPageImpl(driver)
appiumDriver = appium.connect();
WebDriver driver = appiumDriver;
16. The Implementor for IOS
platform - Appium
•
Example of using the obj “appiumPageImpl” to click on btn using selenium Api
• The Method iphoneButtons.get() transform the the getTaxiButton into our the WebLocatore Object
appiumPageImpl.clickOnButton.
(iphoneButtons.get(getTaxiButton.
name()));
Inside AbstractPage Class
17. The Implementor for IOS
platform - Appium
•
Example of using the obj
“appiumPageImpl” to click on
Mouse using Events selenium Api
appiumPageImpl.selectAutoCompleteOptionWithMouse(iphoneButtons.get(GetTaxiButtonOK.name()));
18. ● QA Testers
● Automation developers
● Architect
● Fullstack Web Developer
● iOS / Android
● Product Manager
● Product Analyst
● BI
● DevOps
● Big Data
● UX/UI designers
WE ARE
HIRING
Mlti platform - E2E scenario runs via few clients : phone user client , DBX and Web , need to be sync , need to compile and load all apps to devices , should be stable , issues with Wifi , networks - real devices … emulators …
The GUI tests might be long due to minimum ride time in the system and cost that we need to pay for stability of the test
Location based - runnin on real device or Genymotion Emulator can’t set geo fix - location via adb it’s not stable and the devices reject it , only emulators accept it , but by running fake gps we can set the location on android , and running with the Geny motion api can get that too.
Since fake gps is not our app we did haking to the fake gps by encode the app and read its manifest and sign it with our debug key.
In ios - appium can be set init’s capabilities to be able to do so