iOS WebKit Debug Proxy

Go back to tutorial

iOS WebKit Debug Proxy

ios_webkit_debug_proxy (aka iwdp) proxies are used to request from usbmuxd daemon over a websocket connection. Further, it allows developer to send commands to MobileSafari and UIWebViews on real and simulated iOS devices. iOS device appium uses ios_webkit_debug_proxy for accessing web views.

Design Features

Installation Process

In which case, iOS WebKit Debug Proxy works on Linux, MacOS and Windows.

On a MacOS

it’s easiest to install with homebrew:

brew install ios-webkit-debug-proxy

On Windows

it’s easiest to install with scoop:

scoop bucket add extras

scoop install ios-webkit-debug-proxy

On Linux

sudo apt-get install autoconf automake libusb-dev libusb-1.0-0-dev libplist-dev libplist++-dev usbmuxd libtool libimobiledevice-dev

git clone https://github.com/google/ios-webkit-debug-proxy.git

cd ios-webkit-debug-proxy

./autogen.sh

make

sudo make install

Building ios-webkit-debug-proxy from source

At first, open the command terminal on your mac. Further, you can find instructions on how to open the terminal via your favorite search engine. Once that is open, verify you have Homebew installed:

$ brew -v

After having Homebrew, it is important to perform the following commands (the $ indicates the command line prompt, do not enter it):

$ cd  ~

$ sudo apt-get install autoconf automake libusb-dev libusb-1.0-0-dev libplist-dev libplist++-dev usbmuxd libtool libimobiledevice-dev

$ git clone https://github.com/google/ios-webkit-debug-proxy.git

$ cd ios-webkit-debug-proxy

$ ./autogen.sh

$ make

$ sudo make install

Using ios-webkit

On Linux, you must run the usbmuxd daemon. The above install adds a /lib/udev rule to start the daemon whenever a device is attached.

To verify that usbmuxd can list your attached device(s), ensure that libimobiledevice-utils is installed, or install it with:

sudo apt-get install libimobiledevice-utils

and then run idevice_id -l

How to Start the simulator or device?

The iOS Simulator is supported, but it must be started before the proxy. The simulator can be started in XCode, standalone, or via the command line:

# Xcode changes these paths frequently, so doublecheck them

SDK_DIR=”/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs”

SIM_APP=”/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator”

$SIM_APP -SimulateApplication $SDK_DIR/iPhoneSimulator8.4.sdk/Applications/MobileSafari.app/MobileSafari

Enable the inspector – Your attached iOS devices must have ≥1 open browser tabs and the inspector enabled via: Settings > Safari > Advanced > Web Inspector = ON

Running ios-webkit-debug-proxy

Once it has been installed, then you can start the proxy with the below command –

# Change the udid to be the udid of the attached device and make sure to set the port to 27753

# as that is the port the remote-debugger uses. You can learn how to retrieve the UDID from

# Apple’s developer resources.

> ios_webkit_debug_proxy -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 -d

Also, you can also set the desired capability called startIWDP to true. This will run the above command as a subprocess from within Appium and will set the udid, so you don’t have to run ios_webkit_debug_proxy yourself anymore. It monitors the proxy for crashes and relaunches when needed.

Further, you may also use ios-webkit-debug-proxy-launcher, a small script included with the Appium codebase, to launch the proxy. It monitors the proxy log for errors, and relaunch the proxy where needed. This is also optional and may help with recent devices:

# change the udid

# note, this is run from an Appium repository

> ./bin/ios-webkit-debug-proxy-launcher.js -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 -d

The proxy requires the “web inspector” to be turned on to allow a connection to be established. Turn it on by going to settings > safari > advanced.

  • Specifying non-default port – Appium expects ios-webkit-debug-proxy to be running on port 27753. If, for whatever reason, this needs to be changed, the webkitDebugProxyPort desired capability can be set with the port on which it the proxy is running.

Enrich your profile and become Job Ready. Practice and Prepare for Mobile Testing (Appium) Exam Now!

Get expert advice and hundreds of Free Test – Try Mobile Testing (Appium) Practice Questions Now!

Go back to tutorial

Automating Hybrid Apps
Chromedriver

Get industry recognized certification – Contact us

keyboard_arrow_up