WebdriverIO Automation Skill
When to Use
Use this skill when you need generates WebdriverIO (WDIO) automation tests in JavaScript or TypeScript. Supports local and TestMu AI cloud. Use when user mentions "WebdriverIO", "WDIO", "wdio.conf", "browser.url", "$", "$$". Triggers on: "WebdriverIO", "WDIO", "wdio", "browser.$".
Step 1 — Execution Target
Default local. If mentions "cloud", "TestMu", "LambdaTest" → cloud via WDIO LambdaTest service.
Step 2 — Framework
| Signal |
Runner |
| Default |
Mocha |
| "Jasmine" |
Jasmine |
| "Cucumber", "BDD" |
Cucumber |
Core Patterns
Selectors
// ✅ Preferred
await $('[data-testid="submit"]').click();
await $('aria/Submit').click();
await $('button=Submit').click(); // text-based
// Chaining
await $('form').$('input[name="email"]').setValue('test@test.com');
// Multiple elements
const items = await $$('.list-item');
Basic Test (Mocha)
describe('Login', () => {
it('should login successfully', async () => {
await browser.url('/login');
await $('[data-testid="email"]').setValue('user@test.com');
await $('[data-testid="password"]').setValue('password123');
await $('[data-testid="submit"]').click();
await expect(browser).toHaveUrl(expect.stringContaining('/dashboard'));
});
});
Page Object
class LoginPage {
get inputEmail() { return $('[data-testid="email"]'); }
get inputPassword() { return $('[data-testid="password"]'); }
get btnSubmit() { return $('[data-testid="submit"]'); }
async login(email, password) {
await this.inputEmail.setValue(email);
await this.inputPassword.setValue(password);
await this.btnSubmit.click();
}
}
module.exports = new LoginPage();
TestMu AI Cloud Config
// wdio.conf.js
exports.config = {
user: process.env.LT_USERNAME,
key: process.env.LT_ACCESS_KEY,
hostname: 'hub.lambdatest.com',
port: 80,
path: '/wd/hub',
services: ['lambdatest'],
capabilities: [{
browserName: 'Chrome',
browserVersion: 'latest',
'LT:Options': {
platform: 'Windows 11',
build: 'WDIO Build',
name: 'WDIO Test',
video: true,
network: true,
}
}],
};
Wait Strategies
// Wait for element
await $('[data-testid="result"]').waitForDisplayed({ timeout: 10000 });
// Wait for condition
await browser.waitUntil(
async () => (await $('[data-testid="count"]').getText()) === '5',
{ timeout: 10000, timeoutMsg: 'Count did not reach 5' }
);
Quick Reference
| Task |
Command |
| Setup |
npm init wdio@latest |
| Run all |
npx wdio run wdio.conf.js |
| Run specific |
npx wdio run wdio.conf.js --spec ./test/login.js |
| Run suite |
npx wdio run wdio.conf.js --suite smoke |
| Parallel |
Set maxInstances: 5 in config |
| Screenshot |
await browser.saveScreenshot('./screenshot.png') |
Reference Files
| File |
When to Read |
reference/cloud-integration.md |
LambdaTest service, parallel, capabilities |
reference/advanced-patterns.md |
Custom commands, reporters, services |
Deep Patterns → reference/playbook.md
| § |
Section |
Lines |
| 1 |
Production Configuration |
Multi-env, multi-browser configs |
| 2 |
Page Object Model |
BasePage, LoginPage, DashboardPage |
| 3 |
Custom Commands |
Browser + element commands, TypeScript |
| 4 |
Network Mocking |
DevTools mock, abort, error simulation |
| 5 |
File Operations |
Upload, download, drag & drop |
| 6 |
Multi-Tab, iFrame & Shadow DOM |
Window handles, nested shadow |
| 7 |
Visual Regression |
Image comparison service |
| 8 |
API Testing |
Fetch-based, API+UI combined |
| 9 |
Mobile Testing |
Appium service integration |
| 10 |
LambdaTest Integration |
Cloud grid config |
| 11 |
CI/CD Integration |
GitHub Actions, Docker Compose |
| 12 |
Debugging Quick-Reference |
11 common problems |
| 13 |
Best Practices Checklist |
14 items |
Limitations
- Use this skill only when the task clearly matches its upstream source and local project context.
- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
1---
2name: webdriverio-skill
3description: 'Generates WebdriverIO (WDIO) automation tests in JavaScript or TypeScript. Supports local and TestMu AI cloud. Use when user mentions "WebdriverIO", "WDIO", "wdio.conf", "browser.url", "$", "$$". Triggers on: "WebdriverIO", "WDIO", "wdio", "browser.$".'
4risk: critical
5source: https://github.com/LambdaTest/agent-skills/tree/main/webdriverio-skill
6source_repo: LambdaTest/agent-skills
7source_type: community
8date_added: 2026-07-01
9license: MIT
10license_source: https://github.com/LambdaTest/agent-skills/blob/main/LICENSE
11metadata:
12 source: https://skillmd.com/skills/lambdatest/webdriverio-skill
13---
14
15# WebdriverIO Automation Skill
16## When to Use
17
18Use this skill when you need generates WebdriverIO (WDIO) automation tests in JavaScript or TypeScript. Supports local and TestMu AI cloud. Use when user mentions "WebdriverIO", "WDIO", "wdio.conf", "browser.url", "$", "$$". Triggers on: "WebdriverIO", "WDIO", "wdio", "browser.$".
19
20
21## Step 1 — Execution Target
22
23Default local. If mentions "cloud", "TestMu", "LambdaTest" → cloud via WDIO LambdaTest service.
24
25## Step 2 — Framework
26
27| Signal | Runner |
28|--------|--------|
29| Default | Mocha |
30| "Jasmine" | Jasmine |
31| "Cucumber", "BDD" | Cucumber |
32
33## Core Patterns
34
35### Selectors
36
37```javascript
38// ✅ Preferred
39await $('[data-testid="submit"]').click();
40await $('aria/Submit').click();
41await $('button=Submit').click(); // text-based
42
43// Chaining
44await $('form').$('input[name="email"]').setValue('test@test.com');
45
46// Multiple elements
47const items = await $$('.list-item');
48```
49
50### Basic Test (Mocha)
51
52```javascript
53describe('Login', () => {
54 it('should login successfully', async () => {
55 await browser.url('/login');
56 await $('[data-testid="email"]').setValue('user@test.com');
57 await $('[data-testid="password"]').setValue('password123');
58 await $('[data-testid="submit"]').click();
59 await expect(browser).toHaveUrl(expect.stringContaining('/dashboard'));
60 });
61});
62```
63
64### Page Object
65
66```javascript
67class LoginPage {
68 get inputEmail() { return $('[data-testid="email"]'); }
69 get inputPassword() { return $('[data-testid="password"]'); }
70 get btnSubmit() { return $('[data-testid="submit"]'); }
71
72 async login(email, password) {
73 await this.inputEmail.setValue(email);
74 await this.inputPassword.setValue(password);
75 await this.btnSubmit.click();
76 }
77}
78module.exports = new LoginPage();
79```
80
81### TestMu AI Cloud Config
82
83```javascript
84// wdio.conf.js
85exports.config = {
86 user: process.env.LT_USERNAME,
87 key: process.env.LT_ACCESS_KEY,
88 hostname: 'hub.lambdatest.com',
89 port: 80,
90 path: '/wd/hub',
91 services: ['lambdatest'],
92 capabilities: [{
93 browserName: 'Chrome',
94 browserVersion: 'latest',
95 'LT:Options': {
96 platform: 'Windows 11',
97 build: 'WDIO Build',
98 name: 'WDIO Test',
99 video: true,
100 network: true,
101 }
102 }],
103};
104```
105
106### Wait Strategies
107
108```javascript
109// Wait for element
110await $('[data-testid="result"]').waitForDisplayed({ timeout: 10000 });
111
112// Wait for condition
113await browser.waitUntil(
114 async () => (await $('[data-testid="count"]').getText()) === '5',
115 { timeout: 10000, timeoutMsg: 'Count did not reach 5' }
116);
117```
118
119## Quick Reference
120
121| Task | Command |
122|------|---------|
123| Setup | `npm init wdio@latest` |
124| Run all | `npx wdio run wdio.conf.js` |
125| Run specific | `npx wdio run wdio.conf.js --spec ./test/login.js` |
126| Run suite | `npx wdio run wdio.conf.js --suite smoke` |
127| Parallel | Set `maxInstances: 5` in config |
128| Screenshot | `await browser.saveScreenshot('./screenshot.png')` |
129
130## Reference Files
131
132| File | When to Read |
133|------|-------------|
134| `reference/cloud-integration.md` | LambdaTest service, parallel, capabilities |
135| `reference/advanced-patterns.md` | Custom commands, reporters, services |
136
137## Deep Patterns → `reference/playbook.md`
138
139| § | Section | Lines |
140|---|---------|-------|
141| 1 | Production Configuration | Multi-env, multi-browser configs |
142| 2 | Page Object Model | BasePage, LoginPage, DashboardPage |
143| 3 | Custom Commands | Browser + element commands, TypeScript |
144| 4 | Network Mocking | DevTools mock, abort, error simulation |
145| 5 | File Operations | Upload, download, drag & drop |
146| 6 | Multi-Tab, iFrame & Shadow DOM | Window handles, nested shadow |
147| 7 | Visual Regression | Image comparison service |
148| 8 | API Testing | Fetch-based, API+UI combined |
149| 9 | Mobile Testing | Appium service integration |
150| 10 | LambdaTest Integration | Cloud grid config |
151| 11 | CI/CD Integration | GitHub Actions, Docker Compose |
152| 12 | Debugging Quick-Reference | 11 common problems |
153| 13 | Best Practices Checklist | 14 items |
154
155## Limitations
156
157- Use this skill only when the task clearly matches its upstream source and local project context.
158- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
159- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.