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
- Clone the repository and finish the setup
$ git clone git@github.com:appium/WebDriverAgent.git $ cd WebDriverAgent $ ./Scripts/bootstrap.sh
- Open
WebDriverAgent.xcodeprojwith Xcode - Open
Edit Scheme - Set
8100as the port
- Run test with
iPhone 8 Plusand11.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
- set up Appium server
$ git clone git@github.com:appium/appium.git $ cd appium $ npm install $ node .
Appium client
- 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.
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