Troubleshooting Exceptions on Mobile - (Appium 1.8.1 is Recommended)


#1

Mobile Testing Exception Troubleshooting Tips

Here are some common troubleshooting steps to take when you encounter errors trying to spy, record, or execute a mobile test in Katalon Studio:

If you see one of the following exceptions, you should check your Appium installation:

  • Execution Exception
  • NullPointerException
  • java.util.HashMap cannot be cast to org.openqa.selenium.WebElement
  • Unable to parse remote response
  • Support for xcode 0.1 is not supported. please upgrade to version 7.3 or higher
  • The instrumentation process cannot be initialized

For Android testing:

For best compatibility, it is recommended that you install Appium Server 1.8.1. Please note that this is NOT the same as Appium Desktop. The compatible version of Appium Desktop is 1.6.3 (which includes Appium Server 1.8.1).

To install Appium Server from the command line, using npm:

npm install -g appium@1.8.1

To install Appium Desktop, download an installer from:

For iOS testing:

If you are building with Xcode 10 and/or testing on iOS 12 devices, it is recommended that you install Appium Server 1.8.2-beta. Please note that this is NOT the same as Appium Desktop. At this time, I do not think there is a compatible version of Appium Desktop for Xcode 10/iOS 12 and Katalon Studio.

To install Appium Server from the command line, using npm:

npm install -g appium@1.8.2-beta

SWTException or Web Driver Exception

This can often be seen on Android tests on login, credit card, or other sensitive data screens. Android allows developers to mark these screens as “secure” so that screenshots cannot be taken. This interferes with Katalon Studio’s Mobile Spy and Test Recorder previews, since they rely on screenshots.

Luckily, even after getting this error, you can still capture and export Test Objects on these screens as you normally would, you just won’t see a preview of the screen while you’re doing it.

Could not proxy command to remote server. Original error: Error connect ECONNREFUSED 127.0.0.1:54339

Clearing Appium Processes

Sometimes there are rogue appium processes that don’t exit when there are Katalon errors. These can interview with new tests and causes them to be unresponsive. To try to clear these out, the most straightforward way is to quit Katalon, close the simulators, and restart your computer.

Alternatively, you can check to see if there are running appium processes in the Terminal using ps -ef | grep appium. You might see something like this:

  501 48742     1   0 Fri02PM ??         0:04.12 /usr/local/Cellar/node/9.11.1/bin/node /Users/chris/.nvm/versions/node/v9.2.0/lib/node_modules/appium/build/lib/main.js --tmp /var/folders/90/26pjk1q50wd9xfn9q3q6tkyc0000gn/T//Katalon/Appium/Temp1551470186488 -p 55334 --chromedriver-port 55335 --log-level info --webkit-debug-proxy-port 0
  501 60974     1   0 Sat11PM ??         0:40.81 /usr/local/Cellar/node/9.11.1/bin/node /Users/chris/.nvm/versions/node/v9.2.0/lib/node_modules/appium/build/lib/main.js --tmp /var/folders/90/26pjk1q50wd9xfn9q3q6tkyc0000gn/T//Katalon/Appium/Temp1551587426507 -p 51192 --chromedriver-port 51193 --log-level info --webkit-debug-proxy-port 0

In these cases, the 2nd column is the process id, e.g. 48742 and 60974. To kill those processes, you can use kill <processid> in the Terminal where <processid> is the id from the listing. If they don’t seem to close, you can be more forceful with kill -9 <processid>.

Try re-running your tests after the processes have been cleared up.

No mobile device with name <device_name> available

This can often be caused by not calling the MobileBuiltInKeywords.startApplication() function at the beginning of a test or calling the function with a non-existent app file.

“Unable to start application…”

There might be a mismatch between the package name and the activity name in your settings.

There are some Appium DesiredCapabilities you can set that might help you get around this. In your Project->Settings menu, go to Execution->Default->Mobile->Android.

Add new entries for appWaitActivity and appWaitDuration. Here’s a description of what those activities mean: http://appium.io/docs/en/writing-running-appium/caps/

When done, it should look something like this:

Name              Type   Value
appWaitActivity   String   *
appWaitDuration   Number   30000

Fail to start Appium server in 60 seconds

This can be caused by Katalon Studio not being able to find the Appium modules under the currently selected version of Node. It can happen when there is a system version of Node installed, but there are also versions of Node installed via Node Version Manager (nvm). The location of Node is not configurable in Katalon Studio, so this can lead to confusion.

To get the node executable to point to your selected version of node on MacOS, you can use symbolic linking:

First you’ll need to remove the system’s current node executable:

rm /usr/local/bin/node

Then create a link to your desired version of Node:

ln -s <YOUR_NODE_LOCATION> /usr/local/bin/node

unable to start application on this device : An unknown server-side error occured while processing the command. Original error : the instrumentation process cannot be initialized
Unable to start application on this device: : An unknown server-side error occurred while processing the command. Original error: Could not install app: 'Command 'ios-deploy --id
I can't spy or record on android mobile
Unable to start application on this device,: Unable to parse remote response: Parameters were incorr
Recorder fails to install apk on mobile devcie
Unable to start app at the desired location-Android Mobile
Mobile testing - error occurred while starting application
java.lang.NullPointerException
'No Driver Found' is causing scripts failure
Error mobile testing
Katalon mobile stuck when running on simulator
Xcode 10 Not Supported in Katalon 5.7.1
Katalon run on iOS 12
I don't know why,please help me!
Common code for Android and IOS
Fail to start the Appium server in 60 seconds?
Cannot use recorder on android
IOS test shows Error 2
Can't start iOS app with katalon
Unable to set Android device "Online" and getting below error
Can't run mobile recorder
Cannot launch application on real iOS device - Original error : "null" cannot be coerced
Failed to start application IOS
Exception when click on Record Mobile button
Problem in executing mobile test case
Error trying to write mobile automation
Error executing adbExec
#2

#3

Nice move @Chris_Trevarthen

I feel bad for seeing you regularly recommending users to install Appium 1.8.1.

Now you can just bookmark this and quote it. :rofl:

Regards !


#4

Hello @Chris_Trevarthen

what is the reason of appium 1.8.1, is because of limitations of katalon or limitations of appium with respect to katalon’s capabilities?


#5

Hi @osss.lcc,

I’m not a Katalon nor Appium developer, but from what I can tell, when Appium when to version 1.9.x, it changed some of the libraries that Katalon came to rely on for interfacing with simulators and devices. Around the same time, there were new versions of Xcode, which complicated things as well.

With the beta release of Katalon Studio 6.2, it looks like the Katalon team is working to support Appium 1.12.1, and hopefully future Appium versions won’t affect the functionality of Katalon Studio as much.

Hope this helps,

Chris


#6

Hello Chris

I have installed the right versions of Katalon and Appium and still i can see the java.lang.NullPointerException error. Please suggest if there is anything more i should do. or if the apk file is corrupt. But looks like its a compatibility issue.

Katalon studios- 6.1.4
Appium- 1.8,.1

Thanks,
Ini


#7

To follow up, putting a link to ini’s solution they found and posted in another thread:


#8

Hello, thanks for the report concerning the troubleshooting exceptions.
So if i understand good, Android and iOS don’t use the same version of Appium (1.8.1 vs 1.8.2-beta).
I execute tests on both system from a MAC OS. Is it possible to have two versions of Appium on the same MAC? Or i need uninstall and reinstall Appium each time i want execute my tests on iOS and Android?

Thank you for your help,
Best regards,
François


#9

Hi @douilly.francois,

You can indeed use the same version of Appium Server for Android and iOS. The reason that there are 2 versions listed are that Xcode10.x and iOS12.x require Appium 1.8.2-beta in order to work, but Android does not have that restriction. So, if you were only running Android tests, it might not be worth going to with an Appium beta, and you can use 1.8.1 instead. However, 1.8.2-beta will work with both Android and iOS.

Hope this helps, and sorry for the confusion,

Chris


#10

Thank you for your fast answer Chris, your messages help me a lot.
Exact for me i need 1.8.2-beta for my tests on iOS12, no choice.
I use Katalon 5.10.1 and I just try the katalon spy on Android 7.0, it works.
I had the web driver exception and i dont see the preview, but as you reported i work on a bank application and i can see the objects tree yet :slight_smile: