Usage Examples
Practical examples for testing Tauri applications with WebdriverIO.
Basic Usage
Element Interactions
Standard WebDriver element interactions work with Tauri apps:
describe('Tauri App Interactions', () => {
it('should interact with form elements', async () => {
// Find elements by selector
const input = await browser.$('input[name="username"]');
await input.setValue('test_user');
const button = await browser.$('button[type="submit"]');
await button.click();
// Wait for element and check visibility
const result = await browser.$('.result');
await result.waitForDisplayed();
const text = await result.getText();
expect(text).toBe('Success!');
});
it('should handle multiple elements', async () => {
const buttons = await browser.$$('button');
expect(buttons).toHaveLength(5);
// Interact with each button
for (const button of buttons) {
const text = await button.getText();
console.log('Button text:', text);
}
});
it('should navigate and wait', async () => {
// Navigate within the app
const link = await browser.$('a[href="#settings"]');
await link.click();
// Wait for page to load
const settings = await browser.$('.settings-panel');
await settings.waitForDisplayed({ timeout: 5000 });
});
});