Ellithium Interaction Classes
Ellithium provides a comprehensive set of interaction classes that offer a unified API for both web and mobile testing. These classes handle synchronization, waiting, and error reporting automatically, making test development more efficient and reliable.
Core Concept: DriverActions
The DriverActions
class is the main entry point to all interactions:
DriverActions actions = new DriverActions(driver);
From this single point, you can access all the specialized interaction classes:
Available Interaction Classes
Interaction Class | Access Method | Description |
---|---|---|
Element Actions | actions.elements() | Basic element interactions (click, type, etc.) |
JavaScript Actions | actions.JSActions() | JavaScript operations |
Alert Actions | actions.alerts() | Alert dialog handling |
Frame Actions | actions.frames() | iFrame operations |
Mouse Actions | actions.mouse() | Advanced mouse operations |
Navigation Actions | actions.navigation() | Browser navigation |
Wait Actions | actions.waits() | Specialized wait conditions |
Window Actions | actions.windows() | Window management |
Key Press Actions | actions.keyPress() | Keyboard interactions |
Select Actions | actions.select() | Dropdown operations |
Screen Recorder Actions | screenRecorderActions | Video recording of test sessions |
For a more detailed overview with code examples, see the Interactions Overview page.
Getting Started with Interactions
Here's a simple example that demonstrates the fluent interface for interactions:
// Initialize driver actions
DriverActions actions = new DriverActions(driver);
// Navigate to URL
actions.navigation().navigateToUrl("https://example.com/login");
// Fill login form
actions.elements().sendData(By.id("username"), "testuser");
actions.elements().sendData(By.id("password"), "password123");
// Click login button
actions.elements().clickOnElement(By.id("loginButton"));
// Wait for successful login
actions.waits().waitForUrlContains("/dashboard");
actions.elements().waitForElementToBeVisible(By.id("welcomeMessage"));
Web vs. Mobile Interactions
Most interaction classes work identically for both web and mobile testing, allowing you to use the same API across different platforms. For mobile-specific functionality, check the Mobile Testing documentation.