[iOS][Appium]How to debug, set break points, WebDriverAgent

Debugging WebDriverAgent is tricky. Appium uses the library to run tests against iOS.

In this article, I’d like to leave how to debug WebDriverAgent using Appium. You can set break points in arbitrary lines on WebDriverAgent via Xcode following below.

On Xcode

  1. Clone the repository and finish the setup
$ git clone git@github.com:appium/WebDriverAgent.git
$ cd WebDriverAgent
$ ./Scripts/bootstrap.sh
  1. Open WebDriverAgent.xcodeproj with Xcode
  2. Open Edit Scheme
  3. Set 8100 as the port
  4. Run test with iPhone 8 Plus and 11.4

Then you can see below logs in console.

Test Suite 'UITestingUITests' started at 2018-06-24 23:48:32.738
Test Case '-[UITestingUITests testRunner]' started.
    t =     0.01s Start Test at 2018-06-24 23:48:32.747
    t =     0.01s Set Up
2018-06-24 23:48:32.755802+0900 WebDriverAgentRunner-Runner[57623:1453006] Built at Jun 24 2018 23:42:12
2018-06-24 23:48:32.807755+0900 WebDriverAgentRunner-Runner[57623:1453006] ServerURLHere->http://172.254.99.34:8100<-ServerURLHere

Appium

  1. set up Appium server
$ git clone git@github.com:appium/appium.git
$ cd appium
$ npm install
$ node .

Appium client

  1. Run arbitrart appium client with below capabilities
platformName: :ios,
automationName: 'XCUITest',
app: 'path/to/test/app',
platformVersion: '11.4', # Same OS version with running simulator
deviceName: 'iPhone 8 Plus', # Same Devive name with running simulator
# useNewWDA: true, # We should disable this capability to avoid uninstalling WDA from the simulator
webDriverAgentUrl: 'http://172.254.99.34:8100' # ServerURLHere->http://172.254.99.34:8100<-ServerURLHere

In my case, I run with the capability on ruby_lib_core.

Then

We can use WDA with breaking point like iOS development.

1 Comment

  1. Long Nguyen's avatar Long Nguyen says:

    Thanks for your trick.

    I just leave this note for other people.

    From version v3.1.0 of WebDriverAgent, there is no need to run the below command anymore.

    $ ./Scripts/bootstrap.sh

    Detail:

    https://github.com/appium/WebDriverAgent/commit/3ae83ebe6fcf7b7fe819b8923960d5718613d25d

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.