Selectors, Actions & Config
Basic Test
describe('Login Page', () => {
it('user can log in', async () => {
await browser.url('https://example.com/login');
await $('#email').setValue('user@example.com');
await $('#password').setValue('secret123');
await $('button[type=submit]').click();
// Built-in retrying assertion — tolerates async UI updates without
// a separate explicit wait before checking
await expect($('h1')).toHaveText('Welcome');
});
});
// $ and $$ resolve lazily — click()/setValue() automatically wait for
// the element to exist and be interactable before runningwdio.conf.js
export const config = {
runner: 'local',
specs: ['./test/specs/**/*.js'],
capabilities: [{ browserName: 'chrome' }],
framework: 'mocha', // or jasmine, cucumber
reporters: ['spec', 'junit'],
services: ['chromedriver'],
};Running Tests
npx wdio config # interactive setup wizard
npx wdio run wdio.conf.js
npx wdio # uses default config locationKeep your own version of these notes — editable, searchable, and organised by your stack.
Start free