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.15.1. Please note that this is NOT the same as Appium Desktop.
To install Appium Server from the command line, using npm:
npm install -g appium@1.15.1
For iOS testing:
If you are building with Xcode 10/11 and/or testing on iOS 12/13 devices, it is recommended that you install Appium Server 1.15.1. _Please note that this is NOT the same as Appium Desktop.
To install Appium Server from the command line, using npm:
npm install -g appium@1.15.1
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: Desired Capabilities - Appium
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
Real iOS Devices Not Showing in Device List
One of the first things you can do is see if the device is recognized by command line tools outside of Xcode:
idevice_id -l
If that does show your device, then it could be that you don’t have permissions to run some of the other command line tools that Katalon (and Appium behind the scenes) require. You can reinstall those tools with:
brew uninstall ideviceinstallerbrew
brew uninstall libimobiledevice
brew uninstall libplist
brew uninstall usbmuxd
brew uninstall ios-webkit-debug-proxy
brew install --HEAD usbmuxd
brew link --overwrite usbmuxd
brew install --HEAD libplist
brew link --overwrite libplist
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
brew install --HEAD ios-webkit-debug-proxy
brew link --overwrite ios-webkit-debug-proxy
sudo chmod -R 777 /var/db/lockdown/