iPad real device issues - Katalon 5.3


#1

Hello,

For few days I am trying to run some very basic iPad real device Katalon test case, but having several issues.

WebDriverAgentRunner is installed on real device using this command, after signing WebDriverAgent.xcodeproj to the free AppleID Developer account inside XCode:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=UDID’ test

This command ends with:

2018-01-27 12:09:42.798009+0100 WebDriverAgentRunner-Runner[266:14952] Running tests…
2018-01-27 12:09:43.878998+0100 WebDriverAgentRunner-Runner[266:14952] Continuing to run tests in the background with task ID 1
Test Suite ‘All tests’ started at 2018-01-27 12:09:44.914
Test Suite ‘WebDriverAgentRunner.xctest’ started at 2018-01-27 12:09:44.920
Test Suite ‘UITestingUITests’ started at 2018-01-27 12:09:44.925
Test Case ‘-[UITestingUITests testRunner]’ started.
t = 0.01s Start Test at 2018-01-27 12:09:44.937
t = 0.02s Set Up
2018-01-27 12:09:44.969278+0100 WebDriverAgentRunner-Runner[266:14952] Built at Jan 26 2018 21:37:57
2018-01-27 12:09:45.039488+0100 WebDriverAgentRunner-Runner[266:14952] ServerURLHere->http://10.0.1.9:0<-ServerURLHere

iPad trust my Mac, and WebDriverAgentRunner is added inside:
iPad > Settings > Device Management as verified app.

Unfortunately connection is refused afterwards:
$ curl -X GET $JSON_HEADER $DEVICE_URL/status
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: accept
curl: (6) Could not resolve host: application
curl: (7) Failed to connect to 10.0.1.9 port 8100: Connection refused

When I start Katalon test case this is happening:

Test Cases/Test-1 FAILED because (of) Unable to open browser with url: ‘’ (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 44.10 seconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘ZM-MacBook.local’, ip: ‘xxxxxxxxxxxxxxxxxxxxxx:760d%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.2’, java.version: ‘1.8.0_102’
Driver info: driver.version: IOSDriver)

Sometimes I can see different error, without changing any configuration:

Test Cases/Test-1 FAILED because (of) Unable to open browser with url: ‘’ (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not navigate to webview; there are none! (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 132.06 seconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘ZM-MacBook.local’, ip: ‘xxxxxxxxxxxxxxxxxxxxxx:760d%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.2’, java.version: ‘1.8.0_102’
Driver info: driver.version: IOSDriver)

And yes, I followed suggested procedure as much as I could, it seems some details are missing !?

Test execution steps and messages:
01 - Starting ‘iOS’ driver
02 - User set preference: [‘deviceId’, ‘id’]
03 - Failed to start ios_webkit_debug_proxy on default port 27753

// here I can see on real iPad device that WebDriverAgentRunner is started and Safari is started too, but desired url is not opened, instead of desired url I can see web page “appium.io

04 - Appium server started on port 54,486

// very long delay

// Test Case failed message

// On live iPad device Safari is hidden and WebDriverAgentRunner is still installed

This simple test case works 100% successful with any other way, e.g. Chrome, XCode iPad simulator, Android Emulator etc.

General info:
iPad mini 2 > Settings Developer > Enable UI Automation = ON
iOS version = 11.2.1
Katalon version = 5.3 Build 1
Appium version = 1.7.2

Inside Katalon Studio > Prefs > Katalon > Mobile I have:
Appium Directory: /usr/local/lib/node_modules/appium
Appium Log Level: Debug

Despite this both appium logs are always size zero:
/Users/usename/Katalon Studio/TEST
$ ls -ltr | grep appium
-rw-r–r-- 1 zlatan staff 0 Jan 26 23:32 appium-proxy-server.log
-rw-r–r--@ 1 zlatan staff 0 Jan 27 00:04 appium.log

Any hints?


#2

XCode version = Version 9.2 (9C40b)


#3

This video helped to fix mentioned issues:
https://www.youtube.com/watch?v=PZkaaDZMBwc

…but now I can see a new error when starting test case with Run option:

Test Cases/Test-1 FAILED because (of) Unable to open browser with url: ‘http://demoaut.katalon.com/’ (Root cause: org.openqa.selenium.WebDriverException: ‘deviceName’ can’t be blank

Why Katalon does not send ‘deviceName’ to the real iOS device automatically!? :frowning:


#4

Zlatan Midzic said:

This video helped to fix mentioned issues:
https://www.youtube.com/watch?v=PZkaaDZMBwc

…but now I can see a new error when starting test case with Run option:

Test Cases/Test-1 FAILED because (of) Unable to open browser with url: ‘http://demoaut.katalon.com/’ (Root cause: org.openqa.selenium.WebDriverException: ‘deviceName’ can’t be blank

Why Katalon does not send ‘deviceName’ to the real iOS device automatically!? :frowning:

Can I see your test script and how do you execute it?


#5

Thank you for replaying!

Please find test script used attached.

Script is executed by using option Run, than selecting my iPad real device which is connected by USB port and on same WiFi network.

I do not get it why this connection is refused:
$ curl -X GET $JSON_HEADER $DEVICE_URL/status
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: accept
curl: (6) Could not resolve host: application
curl: (7) Failed to connect to 10.0.1.9 port 8100: **Connection refused
**

ZM-MacBook:.ssh zlatan$ appium-doctor --ios

info AppiumDoctor Appium Doctor v.1.4.3

info AppiumDoctor ### Diagnostic starting ###

info AppiumDoctor :heavy_check_mark: The Node.js binary was found at: /usr/local/bin/node

info AppiumDoctor :heavy_check_mark: Node version is 9.4.0

info AppiumDoctor :heavy_check_mark: Xcode is installed at: /Applications/Xcode.app/Contents/Developer

info AppiumDoctor :heavy_check_mark: Xcode Command Line Tools are installed.

info AppiumDoctor :heavy_check_mark: DevToolsSecurity is enabled.

info AppiumDoctor :heavy_check_mark: The Authorization DB is set up properly.

info AppiumDoctor :heavy_check_mark: Carthage was found at: /usr/local/bin/carthage

info AppiumDoctor :heavy_check_mark: HOME is set to: /Users/zlatan

info AppiumDoctor ### Diagnostic completed, no fix needed. ###

info AppiumDoctor

info AppiumDoctor Everything looks good, bye!

info AppiumDoctor

ZM-MacBook:.ssh zlatan$


#6

Also this output is much shorter than in your video:

ZM-MacBook:WebDriverAgent zlatan$ ./Scripts/bootstrap.sh -d

Fetching dependencies

Please update to the latest Carthage version: 0.28.0. You currently are on 0.27.0

*** Downloading RoutingHTTPServer.framework binary at “v1.0.1”

*** xcodebuild output can be found in /var/folders/ts/knfy8ql91_50603zlxf00bv00000gn/T/carthage-xcodebuild.7vbfHh.log

ZM-MacBook:WebDriverAgent zlatan$


#7

This is the procedure I used ti set OSX and iOS real device for Katalon Studio:

Step-001: Homebrew installation

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Step-002: Homebrew update

brew update

Step-003: Homebrew doctor

brew doctor

Step-004: export PATH

export PATH="/usr/local/bin:$PATH"

Step-005: Install node

brew install node

Step-006: Install npm

brew install npm

Step-007: Check installation of node and npm

node -v

npm -v

Step-008: Install carthage

brew install carthage

carthage version

Step-009: Install Appium

npm install -g appium

appium -v

Step-010: Setting of appium folder inside Katalon

ZM-MacBook:~ zlatan$ npm install -g appium

/usr/local/bin/appium -> /usr/local/lib/node_modules/appium/build/lib/main.js

Appium folder = /usr/local/lib/node_modules/appium

Set Appium Directory to “/usr/local/lib/node_modules/appium”

in Katalon Preferences (from Katalon menu, go to Preferences > Katalon > Mobile).

Step-011: Add your AppleID in XCode

XCode > Preferences > Accounts > Add AppleID

Step-012: Initialize WebDriverProject

- open in Terminal:

/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

- create this folder there:

mkdir -p Resources/WebDriverAgent.bundle

- execute this script:

./Scripts/bootstrap.sh -d

- open in XCode:

/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj

- sign WebDriverAgentLib and WebDriverAgentRunner:

set unique Build Settings > Product Bundle Identifier

enable Automatically manage signing

choose your Team

Product > Build

Step-013: Build WebDriverAgent (connect iOS device by USB and select “Trust this device”)

xcodebuild -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=11223344556677889900’ test

Output end should be something like this:

Test Case ‘-[UITestingUITests testRunner]’ started.

t =     0.01s Start Test at 2018-01-30 15:30:41.903

t =     0.01s Set Up

2018-01-30 15:30:41.929773+0100 WebDriverAgentRunner-Runner[282:16508] Built at Jan 30 2018 15:12:06

2018-01-30 15:30:42.000393+0100 WebDriverAgentRunner-Runner[282:16508] ServerURLHere->http://10.0.1.9:0<-ServerURLHere

Step-014: iOS Device Management

- If Step-013 failed, please set:

iOS Device > Settings > General > Device Management > “Trust”

- WebDriverAgentRunner-Runner should be marked as “Verified”

Step-014: iOS Device settings:

- enable in Settings > Developer > Enable UI Automation = ON

- enable in Settings > Safari > Advanced > Web inspector = ON

Step-015: Run test from Katalon Studio (TestCase-1.txt) (attached)
- Test is executed with option Run > iOS > “live iOS selected”
- Test Case goal: to start Sarafi on live iOS device and play a little bit with demoaut.katalon.com

Results from Katalon Studio:

Test Cases/Test-1 FAILED because (of) Unable to open browser with url: ‘http://demoaut.katalon.com/’ (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not navigate to webview; there are none! (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 134.66 seconds

Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’

System info: host: ‘ZM-MacBook.local’, ip: ‘some_ip’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.2’, java.version: ‘1.8.0_102’

Driver info: driver.version: IOSDriver)

Test Cases/Test-1.run:23

Step-016: Run Spy Mobile from Katalon Studio:
- error is happening (please see attached AppiumLog.txt)
- also ios-deploy is crashing every time at the end (Error_002.png)
- used .app is simple HelloWorld app which works fine on live iOS device

TestCase-1.txt

AppiumLog.txt

Error_002.png


#8

Versions:

brew -v

Homebrew 1.5.2

node -v

v9.4.0

npm -v

5.6.0

carthage version

Please update to the latest Carthage version: 0.28.0. You currently are on 0.27.0

0.27.0

appium -v

1.7.2

iOS version = 11.2.1

macOS version = 10.13.2

XCode version = Version 9.2 (9C40b)

ios-deploy --version

1.9.2

Katalon Studio version = 5.3 Build 1


#9

For test purposes I did live iPad factory reset, but for both test attempts same errors happened, after step “Failed to start ios_webkit_debug_proxy on default port 27753

But there is one difference, that this working now:

export DEVICE_URL=‘http://10.0.1.9:8100

export JSON_HEADER=’-H “Content-Type: application/json;charset=UTF-8, accept: application/json”’

curl -X GET $JSON_HEADER $DEVICE_URL/status

curl: (6) Could not resolve host: application

curl: (6) Could not resolve host: accept

curl: (6) Could not resolve host: application

{

“value” : {

"state" : "**success**",

"os" : {

  "name" : "iOS",

  "version" : "11.2.5",

  "sdkVersion" : "11.2"

},

"ios" : {

  "simulatorVersion" : "11.2.5",

  "ip" : "10.0.1.9"

},

"build" : {

  "time" : "Jan 30 2018 15:12:09"

}

},

“sessionId” : “B2AD43B7-E985-4DB7-AD86-C37023793692”,

“status” : 0

}


#10

Hi Zlatan,

I just want to ask are you using FREE or PAID Apple account in your setup? These errors from you indicate that there is something wrong with your current configurations

Secondly don’t use .app file. You should use .ipa file instead, .app file is currently not supported and I think that is likely the root cause of your issue when you use Mobile Object Spy.


#11

Vinh Nguyen said:

Hi Zlatan,

I just want to ask are you using FREE or PAID Apple account in your setup? These errors from you indicate that there is something wrong with your current configurations

Secondly don’t use .app file. You should use .ipa file instead, .app file is currently not supported and I think that is likely the root cause of your issue when you use Mobile Object Spy.

Hello Vinh,

Yes I am using free AppleID.

Will try to create .ipa instead to try, but it seems that free AppleID signing of WebDriverAgent can be a root cause. Have to spend some USD to check :slight_smile:

Is there any advices why free AppleID should not work if I am using unique ‘Product Bundle Identifier’, which worked just fine for some Xcode test apps I tested?

Generally to use ‘WebDriverAgent-Runner’ on real iOS devices we need paid AppleID account?

Additional Question:
In Step-012: Initialize WebDriverProject during Product > Build, do we need to select iOS real device which is connected by USB, or just “Generic iOS Device” ?


#12

Hello Vinh,

Some good and some bad news :wink:

I created some .ipa file using Xcode .app build for real iOS device and successfully installed it on my real iPad device using:
(see attach ‘manual_install_OK.txt’)

ios-deploy --id //target_device// --bundle /Users/zlatan/Desktop/Payload2.ipa

After installation application can be used directly on real iPad device without any issues.

Bad news is that Katalon Run > iOS device option having problems to install it using a same command :confused:
(see attach ‘InstallApp_Error.txt’ and ‘TestCase-03.txt’)

Test Cases/Test-3 FAILED because (of) Unable to start app at: ‘/Users/zlatan/Desktop/Payload2.ipa’ (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not install app: ‘Command ‘ios-deploy --id <target_device> --bundle /var/folders/ts/knfy8ql91_50603zlxf00bv00000gn/T/2018030-24452-1da9jey.m9tw/Payload/todo.appexited with code null’ (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 17.41 seconds

Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’

System info: host: ‘ZM-MacBook.local’, ip: ‘<target_device>’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.2’, java.version: ‘1.8.0_102’

Driver info: driver.version: IOSDriver)

Also some good news is that it is possible to use created .ipa file for Spy Mobile and Record Mobile of real iOS device with free AppleID account :smiley:
(see attached ‘SpyMobile_E001_OK.txt’)

So, it seems that Spy Mobile and Record Mobile can be used with .ipa signed with free AppleID, but do you have any idea why Run > iOS can not install .ipa application? :’(

Right now I am not aware how to collect Appium debug logs for you for Run > iOS option, because Katalon > Prefecences > Katalon > Mobile > Debug option does not make any relevant Appium log inside Katalon’s project folder, appium.log file is only 25kb without anything about last Run > iOS session used.

You can see errors in this screenshot:
Failed to start ios_webkit_debug_proxy on default port 27753

Just hope that this issue is not about paid AppleID, still learning Xcode and Katalon with free account option. Somehow I doubt, because manual** ios-deploy** works as well as Spy Mobile and Record Mobile .ipa deployment.

SpyMobile_E001_OK.png

manual_install_OK.txt

SpyMobile_E001_OK.txt

RecordMobile_OK.png

InstallApp_Error.txt

TestCase-03.txt

Run_error_E001_NOK.png


#13

Have you tried to add that application directly into your device using Xcode?
https://docs.katalon.com/display/KD/Mobile+on+macOS#MobileonmacOS-iOS

  • Open Xcode and navigate to Window/Devices
  • Choose your device from the Devices list
  • Press the “+” button and choose you application file

#14

Yes, and it is working fine. Application is installed on real device and usable without any issues. Please find ‘iPad_Console_log_E001.txt’ attached.

In console log:

Jan 31 08:55:11 Zlatans-iPad mobile_installation_proxy(MobileInstallation)[206] : (null):5:1:1:1:Beginning installation for file:///var/mobile/Media/PublicStaging/todo.ipa/ with options {

AllowInstallLocalProvisioned = 1;

IsUserInitiated = 1;

PackageType = Customer;

}

Installation works, but maybe something is missing in .ipa when using **ios-deploy **method by Katalon or some additional ios-deploy flags have to be set.


Application is verified automatically after installation:

DeviceManagement_Verified.png

iPad_Console_log_E001.txt


#15

Additional info: same application but builded for Xcode iOS Simulator works ok, it can be installed and automated by Katalon using
Run > iOS > iOS Simulator.

Xcode_iOS_Sim_OK.png


#16

To share some news. This error:
Failed to start ios_webkit_debug_proxy on default port 27753

… is happening because for some reason real device is not reachable after test case is already started, before starting it on real device I selected “Trust” and of course real device is visible in Katalon “Select device” list before starting the test.

Afterwards “Failed to start ios_webkit_debug_proxy on default port 27753” is happening when executing ios-deploy by Katalon.

If I try to execute this command manually in Terminal, I can see this error:

ZM-MacBook:~ zlatan$ ios-deploy --id <device_id> --bundle /Users/zlatan/Desktop/E002/Payload/test.app

[…] Waiting for iOS device to be connected

[…] Using <device_id> (J85AP, iPad mini 2, iphoneos, arm64) a.k.a. ‘Zlatan’s iPad’.

------ Install phase ------

[ 0%] Found <device_id> (J85AP, iPad mini 2, iphoneos, arm64) a.k.a. ‘Zlatan’s iPad’ connected through USB, beginning install

Assertion failed: (AMDeviceIsPaired(device)), function handle_device, file /usr/local/lib/node_modules/ios-deploy/src/ios-deploy/ios-deploy.m, line 1583.

Abort trap: 6

Any idea why this is happening?

Some workaround which helped me, but it does not looks like a final solution :slight_smile:

- before starting any test case for real device execute this simple script:

# while true; do instruments -s devices | grep <device_id>; done

If this command is running all the time ios_webkit_debug_proxy is started and test case can be executed, also manual ios-deploy command will work just fine, and on real device there will be no any additional pop-up for “Trust”.

Maybe this is not Katalon or Appium issue, but this is factory reseted iPad device, so I do not see any reason for iOS problem, it seems that without checking if device is still available, device will be somehow invisible for OSX and Appium.


#17

Hey Zlatan! I’m having the same problem you mentioned - how do you run that script? I’m trying your workaround but am not having any luck! Everyone once in a while, the device will connect, but more often than not I encounter the same problem you are having.


#18

To be more specific, I’m getting this message repeatedly in the console and am not sure what this could mean:

CoreData: annotation: Failed to load optimized model at path ‘/Applications/Xcode/9.1/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo’


#19

Hello Micaela! Well I just execute thus script from Terminal on macOS before starting Katalon test, and it works for me every time. Maybe you have some additional issue in combination.

I tried to execute that small script manually but connection to the iPad was lost sometimes under 1-2 sec, so I decided start its repetition without any timeouts.

Just one line in any terminal:
# while true; do instruments -s devices | grep <device_id>; done


#20

This is code signing issue, it happens when setup for appium have some problem in configuring webdriver-agent in appium library, you can even configure webdriver-agent with free apple developer account as well, follow these steps in video: https://www.youtube.com/watch?v=dyijACVRQOc It worked for me, hope it will help everybody here!