WebDriverAgent is a WebDriver server implementation for iOS that can be used to remote control iOS devices. It allows you to launch & kill applications, tap & scroll views or confirm view presence on a screen. This makes it a perfect tool for application end-to-end testing or general purpose device automation. It works by linking XCTest.framework
and calling Apple's API to execute commands directly on a device. WebDriverAgent is developed and used at Facebook for end-to-end testing and is successfully adopted by Appium.
- Works with device & simulator
- Implements most of WebDriver Spec
- Implements part of Mobile JSON Wire Protocol Spec
- USB support for devices
- Inspector endpoint with friendly user interface to inspect current device state
- Easy development cycle as it can be launched & debugged directly via Xcode
- Unsupported yet, but works with tvOS & OSX
To get the project set up just run bootstrap script:
./Scripts/bootstrap.sh
It will:
After it is finished you can simply open WebDriverAgent.xcworkspace
and start WebDriverAgentRunner testRunnerSocket
and start sending requests.
For building client manually :
sh ./Scripts/build-socket.sh
Start Node Server :
sh ./Scripts/start-server.sh
Open "http://localhost:8000" : You will see the connected devices. If there is no devices, run the WebDriverAgentRunner testRunnerSocket
.
Check all available Device :
instruments -s devices
Run the below command to start simulator :
xcodebuild test -workspace WebDriverAgent.xcworkspace -scheme WebDriverAgentRunner -destination "platform=iOS Simulator,OS=11.2,name=iPhone 8 Plus"
update -destination
for devices as available in your system.
For running in Real device, You need to provide the device id :
xcodebuild test -workspace WebDriverAgent.xcworkspace -scheme WebDriverAgentRunner -destination "platform=iOS,id=8c9406453401735ad174d8f4118e2347772fc969"
NOTE:
Before running in device Go to the SocketIO project, put BITCODE_GENERATION_MODE
as marker
and ENABLE_BITCODE
as NO
Replace "localhost" in FBWebSocket.m with the ip address where Node server is running.
In case the program builds but there is the following run error Testing failed: Linker command failed with exit code 1 (use -v to see invocation) ** TEST FAILED **
The following build commands failed: Ld /Users/USER_NAME/Library/Developer/Xcode/DerivedData/WebDriverAgent-ajlpezvrbmujhvcgzjblwcnckdvv/Build/Products/Debug-iphoneos/SocketIO.framework/SocketIO normal arm64
Go to the SocketIO project, put BITCODE_GENERATION_MODE
as marker
and ENABLE_BITCODE
as NO
More about how to start WebDriverAgent here.
If you are having some issues please checkout wiki first.
If you want to help us out, you are more than welcome to. However please make sure you have followed the guidelines in CONTRIBUTING.
WebDriverAgent
is BSD-licensed. We also provide an additional patent grant.
Have fun!