A hands-on WebdriverIO tutorial for web apps, in TypeScript: from npm init wdio to a suite that runs in parallel on Chrome, Firefox and Safari in the cloud. Every demo in this video is a real run of the course code.
What you'll learn
- Set up a WebdriverIO 10 project with npm init wdio, TypeScript and Mocha
- Selectors: CSS, role and text selectors, $$ lists, and strict $ (StrictSelectorError)
- async/await, auto-waiting, waitForDisplayed and waitUntil instead of pause()
- Retrying assertions with expect-webdriverio
- Page objects for the login flow
- Running on TestingBot across Chrome and Firefox on Windows 11 and Safari on macOS, with the TestingBot service
- Parallel runs with maxInstances, suites and running a subset
- JUnit reports, screenshots on failure and GitHub Actions
- Debugging with the session video, browser.debug() and log levels
The full course, with code, quick checks and a knowledge check, is free and needs no account: WebdriverIO Tutorial in TypeScript. Free TestingBot WebdriverIO certification (pass the exam and run the course suite green on TestingBot; issued by TestingBot, not by the WebdriverIO project or the OpenJS Foundation): certification details.
Chapters
- 0:00 Course introduction
- 0:52 WebdriverIO: runner, auto-waiting and strict selectors
- 1:15 Chapter 1: Set Up a WebdriverIO Project in TypeScript
- 1:51 Chapter 2: WebdriverIO Selectors: CSS, Text, Role and $$
- 2:26 Chapter 3: Async/Await, Auto-Waiting and Explicit Waits
- 3:09 Chapter 4: Assertions with expect-webdriverio
- 3:45 Chapter 5: Page Objects in WebdriverIO
- 4:19 Chapter 6: Run WebdriverIO on TestingBot Across Browsers
- 6:49 Chapter 7: Parallel Runs, Suites and Running a Subset
- 7:32 Chapter 8: Reporters, Screenshots on Failure and CI
- 8:22 Chapter 9: Debugging WebdriverIO Tests
- 8:42 Chapter 10: Knowledge check
The presenter is an AI avatar of Jochen Delabie (TestingBot), voiced by a stock AI voice.
Video transcript
Course introduction
Hi, I'm Jochen from TestingBot. This free course teaches WebdriverIO for web apps, in TypeScript. You'll need Node.js 22.23 or newer, some JavaScript, and Chrome. No WebdriverIO experience needed. Chapter by chapter, you build one project. You start from npm init wdio, pick selectors that say what an element is, and let WebdriverIO wait for you instead of pausing. You assert with retrying matchers, and move the pages into page objects. In chapter six, the same suite runs on TestingBot, on Chrome, Firefox and Safari. Then you run in parallel, write reports and screenshots in CI, and debug with the session video. When you're done, you can earn the free TestingBot certification. Let's get started.
WebdriverIO: runner, auto-waiting and strict selectors
Before any code, three things explain how a WebdriverIO suite looks. It's a test runner, not just a client: one config file, a worker per spec file and browser, and reporters. Every command is async and auto-waits. And dollar is strict: one selector, one element.
Chapter 1: Set Up a WebdriverIO Project in TypeScript
Chapter one creates the project with npm init wdio: TypeScript, Mocha, Chrome and the spec reporter. You trim the config to the options that matter, such as baseUrl, waitforTimeout and maxInstances. There's no ChromeDriver to install. Here's the starter spec, logging in to the practice site. npm run wdio, in the new project. Chrome opens, logs in to the practice site, and checks the secure area. One spec file passed.
Chapter 2: WebdriverIO Selectors: CSS, Text, Role and $$
Chapter two is about selectors. Dollar finds one element, double dollar finds them all. You use CSS, role selectors, and text selectors like button equals Login. And since version ten, a selector that matches two elements throws, instead of quietly clicking the first. Here are all three tests. The selectors spec, in Chrome. Role and text selectors log in, the checkbox list gets ticked, and the strict-mode error is expected. Three passing.
Chapter 3: Async/Await, Auto-Waiting and Explicit Waits
Chapter three is about waiting. Await every command. Element commands and expect matchers wait on their own, so no pause. To wait for something to go away, use waitForDisplayed with reverse. For anything else, waitUntil with a timeout message. The practice site adds its own five-second delays. Three waiting tests. The first waits about five seconds for Hello World, without a single pause. The second waits for the loading bar to go away. Three passing, in about thirteen seconds: mostly the site's own delays.
Chapter 4: Assertions with expect-webdriverio
Chapter four covers assertions with expect-webdriverio. Matchers on the browser, on elements and on lists retry until they pass or time out. You check titles, URLs, text, classes and values, and you'll meet the strict-mode error on purpose. Here are the three assertion tests. The assertions spec. Title, URL, table text, classes, input values and a plain value. Three passing.
Chapter 5: Page Objects in WebdriverIO
Chapter five moves the login into page objects. A base page opens paths and holds the flash message. Selectors are getters, actions are methods, and the specs do the asserting. The login spec now reads like the user story: log in, check the secure page, log out. The login spec, now through page objects. Log in, check the secure area, log out. Then a wrong password shows the error. Two passing.
Chapter 6: Run WebdriverIO on TestingBot Across Browsers
Chapter six runs the suite on TestingBot. A separate cloud config points WebdriverIO at the grid and lists Chrome and Firefox on Windows 11, and Safari on macOS. The TestingBot service names every session and marks it passed or failed. Here it is, running for real. First, your credentials. In the TestingBot member area, open Settings, then Security. The API Credentials card has your key and secret, each with a copy button. Keep them out of your code. Export them as TESTINGBOT_KEY and TESTINGBOT_SECRET; the cloud config reads them from the environment. In CI, store them as secrets. The login spec on three browsers, two at a time, on the TestingBot grid. Chrome and Firefox on Windows 11 start first. This demo account runs two sessions at a time, so Safari waits for a free slot. Then Safari on macOS runs the same two tests. Three sessions, all passed. In the TestingBot dashboard, the build groups the three sessions: the login spec on Chrome, Firefox and Safari, and every one passed. It also compares this build with the one before. How the build ran shows each session as a bar, one row per parallel slot. Two ran side by side here. The more sessions you run in parallel, the sooner the whole suite finishes. The summary shows the wall time, and how busy your parallel slots were, so you can see when more slots would speed things up. Open a session to see the environment, here Chrome 157 on Windows 11, and every command WebdriverIO sent, with its parameters. The video shows the browser: here, the secure area after logging in. The TestingBot service marks where each test starts. Here the second test enters a wrong password, and the page says it's invalid. Where a test runs is just capabilities: pick the browser, version and platform, set the screen resolution, and add options such as geolocation. The capabilities generator writes the code for you.
Chapter 7: Parallel Runs, Suites and Running a Subset
Chapter seven is about parallel runs. WebdriverIO starts a worker per spec file and browser, and maxInstances caps how many run at once. On a grid, keep it at your plan's parallel limit. Suites and the spec flag run a subset. Here are all four spec files, four at a time. All four spec files, four workers. Four Chrome windows run at once, one per spec file. The waiting spec takes longest, so it sets the total. Four spec files passed, in fourteen seconds.
Chapter 8: Reporters, Screenshots on Failure and CI
Chapter eight adds reports for CI: the JUnit reporter writes one XML file per worker, and an afterTest hook saves a screenshot when a test fails. Then it all runs from GitHub Actions. Here's a test that fails on purpose, on all three browsers on the grid. A deliberately failing spec, on all three browsers. Each one expects the heading Welcome back, and gets Login Page. The hook saves a screenshot before each session closes, and the JUnit reporter writes one file per worker. Three failures, three screenshots, three XML files.
Chapter 9: Debugging WebdriverIO Tests
Chapter nine is about debugging. Read the whole error first. Then watch the session video in TestingBot, which shows what the browser really did. To explore a live page, stop the test with browser dot debug, and turn the log level up when you need every command.
Chapter 10: Knowledge check
That's the course. The last chapter is a knowledge check: ten questions, each with a short explanation. If you'd like something to show an employer, take the free TestingBot certification: pass the exam, and run the course suite green on TestingBot. Both are linked from the course page.