Top Related Projects
Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
Calabash for iOS
:tea: iOS UI Automation Test Framework
Keep It Functional - An iOS Functional Testing Framework
Gray box end-to-end testing and automation framework for mobile apps
Quick Overview
WebDriverAgent is a WebDriver server implementation for iOS that can be used to control iOS devices remotely. It was originally developed by Facebook but is now archived. The project allows for automated testing of iOS applications using various testing frameworks and tools that support the WebDriver protocol.
Pros
- Enables automated testing of iOS applications
- Compatible with multiple testing frameworks and tools
- Provides a way to interact with iOS devices programmatically
- Open-source project with a history of community contributions
Cons
- Archived project, which means it's no longer actively maintained by Facebook
- May have compatibility issues with newer iOS versions
- Setup and configuration can be complex for beginners
- Performance may vary depending on the device and test complexity
Code Examples
// Example 1: Launching an application
[[[XCUIApplication alloc] initWithBundleIdentifier:@"com.example.app"] launch];
This code snippet demonstrates how to launch an application using its bundle identifier.
// Example 2: Tapping an element
XCUIElement *button = [[XCUIApplication alloc] init].buttons[@"Submit"];
[button tap];
This example shows how to find a button element by its accessibility identifier and tap it.
// Example 3: Entering text into a text field
XCUIElement *textField = [[XCUIApplication alloc] init].textFields.firstMatch;
[textField typeText:@"Hello, WebDriverAgent!"];
This code demonstrates how to locate a text field and enter text into it.
Getting Started
-
Clone the WebDriverAgent repository:
git clone https://github.com/facebookarchive/WebDriverAgent.git
-
Install dependencies:
cd WebDriverAgent ./Scripts/bootstrap.sh
-
Open the project in Xcode:
open WebDriverAgent.xcodeproj
-
Configure the project with your Apple Developer account and provisioning profiles.
-
Build and run the WebDriverAgentRunner target on your iOS device or simulator.
-
Use a WebDriver client (e.g., Appium, Selenium) to connect to the WebDriverAgent server and start automating your iOS app.
Competitor Comparisons
Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
Pros of Appium
- Cross-platform support for iOS, Android, and Windows
- Supports multiple programming languages (Java, Python, Ruby, etc.)
- Large community and extensive documentation
Cons of Appium
- Slower test execution compared to native frameworks
- More complex setup and configuration
- Potential for flaky tests due to additional abstraction layer
Code Comparison
WebDriverAgent (Objective-C):
- (XCUIElement *)findElementByXPath:(NSString *)xpath
{
return [[self class] throwException:@"WebDriverAgent doesn't support XPath locators"];
}
Appium (JavaScript):
driver.findElement(By.xpath('//button[@name="Submit"]'))
.then(function(element) {
return element.click();
});
Key Differences
- WebDriverAgent is specifically for iOS automation, while Appium supports multiple platforms
- WebDriverAgent uses Objective-C, whereas Appium primarily uses JavaScript
- Appium provides a higher-level abstraction, making it easier for non-native developers to write tests
- WebDriverAgent offers more direct access to iOS internals, potentially allowing for more precise control
Use Cases
- Choose WebDriverAgent for iOS-specific testing with native performance
- Opt for Appium when cross-platform support and language flexibility are priorities
Calabash for iOS
Pros of Calabash-iOS
- Supports both iOS and Android platforms, allowing for cross-platform test automation
- Integrates well with Cucumber, enabling behavior-driven development (BDD) practices
- Provides a rich set of predefined steps for common mobile interactions
Cons of Calabash-iOS
- Requires Ruby knowledge, which may be a barrier for some teams
- Less active development and community support compared to WebDriverAgent
- May have compatibility issues with newer iOS versions due to slower updates
Code Comparison
Calabash-iOS (Ruby):
calabash_launcher = Calabash::Cucumber::Launcher.new
calabash_launcher.relaunch
touch("button marked:'Login'")
enter_text("textField", "username")
WebDriverAgent (Python with Appium):
driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)
driver.find_element_by_accessibility_id("Login").click()
driver.find_element_by_class_name("XCUIElementTypeTextField").send_keys("username")
Both frameworks provide ways to interact with iOS app elements, but Calabash-iOS uses a more domain-specific language, while WebDriverAgent (typically used with Appium) follows a more standard WebDriver protocol. WebDriverAgent offers more flexibility and broader language support, while Calabash-iOS provides a more streamlined experience for BDD-style testing with Cucumber integration.
:tea: iOS UI Automation Test Framework
Pros of EarlGrey
- More lightweight and faster execution compared to WebDriverAgent
- Better integration with Xcode and iOS development workflow
- Supports both Objective-C and Swift natively
Cons of EarlGrey
- Limited to iOS testing only, while WebDriverAgent supports both iOS and tvOS
- Requires more setup and configuration for CI/CD environments
- Less extensive documentation and community support
Code Comparison
EarlGrey example:
EarlGrey.selectElement(with: grey_accessibilityID("button_id"))
.perform(grey_tap())
WebDriverAgent example:
driver.find_element_by_accessibility_id("button_id").click()
Both frameworks provide ways to interact with UI elements, but EarlGrey's syntax is more Swift-friendly, while WebDriverAgent uses a more standard Selenium-like approach.
EarlGrey is better suited for developers deeply integrated into the iOS ecosystem, while WebDriverAgent offers more flexibility for cross-platform testing and integration with various testing frameworks.
Keep It Functional - An iOS Functional Testing Framework
Pros of KIF
- Lightweight and easy to integrate into existing iOS projects
- Focuses on functional testing within the app's process, providing faster test execution
- Supports both Objective-C and Swift, making it versatile for different iOS codebases
Cons of KIF
- Limited to iOS platform, unlike WebDriverAgent's cross-platform support
- Lacks some advanced features and tools available in WebDriverAgent
- May require more manual setup for certain test scenarios
Code Comparison
KIF example:
tester().tap(withAccessibilityLabel: "Login")
tester().enterText("username", intoViewWithAccessibilityLabel: "Username")
tester().enterText("password", intoViewWithAccessibilityLabel: "Password")
tester().tap(withAccessibilityLabel: "Submit")
WebDriverAgent example:
driver.find_element_by_accessibility_id("Login").click()
driver.find_element_by_accessibility_id("Username").send_keys("username")
driver.find_element_by_accessibility_id("Password").send_keys("password")
driver.find_element_by_accessibility_id("Submit").click()
Both frameworks provide ways to interact with UI elements, but KIF uses a more iOS-specific approach, while WebDriverAgent follows a more standardized WebDriver protocol, allowing for cross-platform compatibility.
Gray box end-to-end testing and automation framework for mobile apps
Pros of Detox
- Cross-platform support for both iOS and Android
- Faster test execution due to its gray-box testing approach
- Better integration with React Native projects
Cons of Detox
- Steeper learning curve for developers new to E2E testing
- Less mature ecosystem compared to WebDriverAgent
- Limited support for native iOS/Android components
Code Comparison
WebDriverAgent (Objective-C):
- (XCUIElement *)elementForAccessibilityElement:(XCAccessibilityElement *)element
{
XCUIElementQuery *query = [self.application descendantsMatchingType:XCUIElementTypeAny];
return [query elementMatchingPredicate:[NSPredicate predicateWithFormat:@"identifier == %@", element.identifier]];
}
Detox (JavaScript):
await element(by.id('login_button')).tap();
await expect(element(by.text('Welcome'))).toBeVisible();
WebDriverAgent uses Objective-C and interacts directly with XCUITest, while Detox provides a higher-level JavaScript API for writing tests. Detox's approach is more accessible for web developers and integrates well with JavaScript-based mobile frameworks like React Native. However, WebDriverAgent offers more fine-grained control over native iOS components and may be preferred for complex native app testing scenarios.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
WebDriverAgent
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.
Archiving
We are archiving WebDriverAgent. Thanks to the community who have used it! The code will remain here for your future use, but will no longer be actively supported by Facebook.
In May 2019, we open sourced IDB, âiOS Development Bridgeâ, a command line interface for automating iOS Simulators and Devices. We are currently migrating our own internal projects from WDA to IDB, and suggest checking it out as an alternative.
More information on IDB:
Overview
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 was developed and used at Facebook for end-to-end testing and is successfully adopted by Appium.
Features
- 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
Getting Started
To get the project set up just run bootstrap script:
./Scripts/bootstrap.sh
It will:
After it is finished you can simply open WebDriverAgent.xcodeproj
and start WebDriverAgentRunner
test
and start sending requests.
More about how to start WebDriverAgent here.
Known Issues
If you are having some issues please checkout wiki first.
For Contributors
If you want to help us out, you are more than welcome to. However please make sure you have followed the guidelines in CONTRIBUTING.
License
WebDriverAgent
is BSD-licensed. We also provide an additional patent grant.
Have fun!
Top Related Projects
Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
Calabash for iOS
:tea: iOS UI Automation Test Framework
Keep It Functional - An iOS Functional Testing Framework
Gray box end-to-end testing and automation framework for mobile apps
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot