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