How to Fix Common Errors with Appium Testing Framework

Appium mobile testing is an open-source tool and system for automating mobile web, native, and hybrid applications on both iOS and Android platforms. It runs great on native apps – the ones that are written utilizing the iOS or Android SDKs, mobile web applications that are reached utilizing a mobile browser and hybrid apps that are using the webview and are covered within your app.

It has NO reliance on Mobile device OS. Since APPIUM has wrapper or framework that makes the translation of Selenium Webdriver commands into UIAutomator (Android) or UIAutomation (iOS) commands relying upon the type of device, no OS type.

All languages that have Selenium client libraries are supported by the Appium such as – Objective-C, Java, JavaScript with node.js, Ruby, PHP, Python, C#, and so on.

But today, we’ll try to propose the fresh look at this system. There are several diverse blogs out there that concentrate on Appium and give tips and tricks for different topics. In this blog series, we will disclose to you the possible errors one might encounter using Appium.

Let’s begin.

  • Error #1. Could not connect to Lockdownd (on iOS)

sudochmod -R 777 /var/db/lockdown/
In case that you still face the problem then use below steps to solve the issue-
try to uninstall the ios-webkit-debug-proxy and install once more.
brew uninstall — force libimobiledeviceios-webkit-debug-proxy
brew install — HEAD libimobiledeviceios-webkit-debug-proxy
brew update
brew reinstall — HEAD libimobiledevice
brew reinstall -s ios-webkit-debug-proxy

  • Error #2. Misusing XPath

Misusing XPath locators is a mutual mistake with Selenium, in spite of the fact that it’s more unfortunate error in the Appium environment.

Appium XPath is a great method to discover elements, yet it accompanies a really enormous execution cost. This is because of XML-and XPath-type questions, that are not locally given by Apple and Google – in any event in the form that we’d prefer them to be.

Also Read : How to Install Appium Server and Node on Windows through Command Line

This drives Appium to make a ton of costly calls in the engine to help to discover elements assuredly when utilizing XPath.

So, you can utilize XPath, however, there are far superior locator methods you can apply – such as the accessibility IDs.

  • Error #3. Script taking longer to Load (on iOS)

The script will be taking forever to load and launch on a real device.

Try these ways to solve the error –

If before installed, then uninstall or delete the WebDriverAgent app from your real test simulator or device.

In case that uninstalling doesn’t fix the issue, restart the mobile and attempt running your tests.

  • Error #4. The Issue during swiping down action on the iOS Device

When the configuration is done and the execution is triggered, strangely there are issues simply for the scripts in which there was a swipe down action to perform for opening the spotlight search on the phone.

There is a potential suspect for this unknown server error. This is –

The reason behind the error was WDA. So, clean it and build it over.
1. Open the WebDriverAgent.xcodeproj in Xcode and choose WebDriverAgentRunner in the scheme prior to developing, ensure that it is signed.
2. Start the runner by running the tests.
3. In case all is fine, the screen on the device will become black and afterward revert to the application screen. The newly installed WebDriverAgentRunner. on the phone is seen.
4. The server is working while the tests run.

  • Error #5. Found Internal Error while running the Command. (on iOS)

Error: Could not initialize ios-deploy make sure it is installed (npm install -g ios-deploy) and works on your system.
You have to ensure that you have enabled turned ON the UI Automation toggle running Appium scripts for the device.
Settings > Developer > Enable UI Automation
Additionally, note that while working with native safari, make sure you begin the iOS debug proxy, also that the connection to your device is set prior to starting of the appium server either through app UI or the command line.
In the terminal, run these commands –
ios_webkit_debug_proxy -c <device udid>:27753
Start appium
Now try running your test scripts.

  • Error #6. Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

You apparently need to configure the SDK root directory path in system ‘Environment Variables’ under ‘Path’ column.
Error- The following desired capabilities are needed but were not provided: platformName, device Name
Add needed capabilities: platformName, device Name in APPIUM script.

  • Error #7. Error on connecting the real iOS device with Appium server

When you open an app through Appium server though get the following error –
An unknown server-side error occurred while processing the command. Original error: Unknown device or simulator UDID: ‘046e4469d6cb14ff57e378599bd4b1d09390472b’
“platformName”: “iOS”,
“deviceName”: “iPad”,
“automationName”: “XCUITest”,
“udid”: “046e4469d6cb14ff57e378599bd4b1d09390472b”,
“bundleId”: “com.***”,
“platformVersion”: “11.2.6”,
“app”: “/Users/***/***.ipa”
To solve the issue, use the below-given configuration –
“platformName”: “iOS”,
“platformVersion”: “10.2.1″,
“deviceName”: “——”,
“udid”: “fdbe0d55ced1fd6fa842681b6a058438573fb762″,
“app”: “/Users/—-/—/—/—.ipa”,
“automationName”: “XCUITest”
Depending upon app path, it will detect the app that needs to be loaded, further, you have to implement the iOS version (device OS version for the device or XCode ios simulator version for simulator/).

  • Error #8. Xcode9.1+IOS 11.1.2+APPIUM1.2.7 runtime throws exceptions,’11.1.2’does not exist in the list of simctl SDKs. (on iOS)

Run with the accessible version of the simulator.

  • Error #9. Running iOS test.

Error message – [INST STDERR] posix spawn failure; aborting launch
Your app is not assembled precisely for the device or simulator.

  • Error #10. Issue while running mobile safari test.

Error message – Could not prepare mobile safari with version ‘7.1’
You apparently have to run the authorize script newly to make the iOS SDK files writeable.

  • Error #11. Appium Java JUnit test package unzip failed (on Linux x86_64 or Mac)

You will see the following error message –
We could not open your test ZIP file. Please verify that the file is valid and try again.
You have to ensure that you can unzip the test package with no errors. In the following case, the name of the package is
Copy your test package in your working directory. Then run the given command –
$ unzip
When you have successfully unzipped the package, you can see the operating directory tree structure by running the below-given command –
$ tree .
A valid Appium Java JUnit package must provide an output as following –
|— acme-android-appium-1.0-SNAPSHOT.jar (this is the JAR containing everything built from the ./src/main directory)
|— acme-android-appium-1.0-SNAPSHOT-tests.jar (this is the JAR containing everything built from the ./src/test directory)
|— (this .zip file contains all of the items)
`— dependency-jars  (this is the directory that contains all of your dependencies, built as JAR files)
|— com.another-dependency.thing-1.0.jar
|— joda-time-2.7.jar
`— log4j-1.2.14.jar

Why Appium is Impeccable in iOS and Android App Testing

Since mobile testing involves testing the applications across different devices and platforms such as Android and iOS, the task can become quite hectic. Thankfully, there is way out of this, and that is to use the mobile automation tools. Though there are many mobile automation tools available at present, Appium proves to be the most effective and accessible.

app testing

Appium is flexible, feature-rich, scalable, and hugely helpful. And learning it would ease the job of every mobile tester. Well, if you are curious to know about Appium and its features, we can help you with that by providing necessary details.

Appium – The Open Source Mobile Application

Appium is just an open source mobile application for mobile automation. Appium supports native, hybrid, and web application automation test across physical devices including both an emulator and stimulator. It even enables cross-platform app testing where its real beauty lies.

Appium let the user write tests for multiple platforms including iOS, Android, and Windows Phone using the same API. It means that you could write a test for iOS and use the same test for Windows Phone and Android.  It saves time and aids the software tester to reuse a large number of codes between different test suites.

Another great feature of Appium is that it has no dependency on Mobile device OS. It is because Appium has a framework or wrapper that could translate Selenium Webdriver commands to UIAutomation or UIAutomator commands based on the type of device. Furthermore, Appium supports almost all languages which have Selenium client libraries.

Appium even showcases a neat feature that can automate without recompiling the app. It means that the user doesn’t need to have access to the application code to work with Appium. Whereas, other mobile automation tools like Frank and Calabash demands the user to be aware of the app code to be able to work with it. Thus, you could test the same app which you will be going to submit to the app store.

A bonus comes along with the philosophy on which Appium is built. The theory follows four tenets which will be discussed below.

Appium Philosophy and the Four Tenets

No automation or recompiling your app – As we have read earlier, Appium doesn’t require an extra agent or an app code to work. Therefore, the user doesn’t have to recompile or modify the app to automate it.

No requirement of a specific language or framework – Appium supports all languages when it comes to writing tests. Ruby, Python, Java, Node.js, Objective, PHP and you name it. Users wouldn’t have to learn a new language to work with the tool.

No reinventing the wheel – A better tool for mobile application shouldn’t reinvent the wheel when it comes to automation APIs. Appium uses WebDriver API, and so there is no hassle of reinventing the wheel by introducing an entirely new API.

A framework should be open source and practical – Appium is freely available to all the users and can be easily modified as per the user’s requirements. Furthermore, Appium is completely practical and real in spirit.

Appium and the Way It Works

Appium is an HTTP server written using a Node.js platform. It drives iOS and Android session using WebDriver JSON wire protocol. Once Appium is downloaded and installed on your device, a server is set up on the machine that gives REST API the required exposure. Later, it receives connection and command request from clients and takes necessary actions to execute the command.

Appium responds back using HTTP responses and uses mobile test automation frameworks to execute the request.

Prerequisites When Using Appium

Before you get started with Appium, you are required to install a few of the below-listed applications to work efficiently with Appium.

  • Android SDK
  • Java Development Kit
  • Eclipse
  • TestNG for Eclipse
  • Selenium Server
  • Appium Client Library
  • APK App Info on Google Play
  • Appium Desktop

Limitations of Using Appium

The most significant limiting factor of using Appium would be its inability to synchronise with AUT accurately. To put it simple words, while the automation tests are running, it may take some time for the action to complete. It may be waiting for some element to load or get ready so that the user can move forward to the next step. However, Appium doesn’t handle this situation diligently. One could put a “wait command” to overcome this delay. Nonetheless, this cannot act as a permanent solution and can turn your automation test to run slowly. Tools like Espresso and EarlyGrey could efficiently take care of situations like this.

Again, Appium is quite a tough tool to handle when you are a complete beginner in the process. You will also require a Mac system to run iOS tests, and iOS apps cannot be automated on Windows or Linux systems. This is due to the reason that Appium requires Xcode for iOS automation which is Mac-only at present.

Appium can again be a tough nut to crack when users look at it from the scalability perspective. Due to the technical limitations, users can only execute one test at a time Mac. This can be a great set back when buying Mac and buying multiple Macs to solve the situation can prove to be costly. Nonetheless, the only way to address this issue is to take aid from mobile cloud services such as SauceLabs.

Click on the below link to watch the tutorial for testing iOS apps with Appium. The video includes tutorials for setting up Appium on your device to writing the first test on OS X

Automating mobile application using Appium Selenium