Knowledge check
Nine questions on the decisions that matter most in a real WebdriverIO suite. Each answer comes with a short explanation, so a wrong answer points you back to the right chapter.
1. npm init wdio stops with "Unsupported Node.js Version" on a machine with Node.js 22.18. What do you do?
WebdriverIO 10 requires recent releases of the 22, 24 and 26 lines; odd-numbered lines such as 23 are not supported. An older starter would install an older WebdriverIO, and engines does not change what the runtime supports.
2. A menu has three links with the class nav-link. await $('.nav-link').click() throws a StrictSelectorError. You want the link labelled "Pricing". What do you write?
A tag-qualified text selector names the one element you mean and survives a reorder of the menu. Turning strictness off or indexing clicks whichever link happens to be first.
3. A selector works in Chrome but matches two elements in Firefox: the input and its label. Which kind of selector is most likely involved?
aria/ matches any element with that accessible name, and how a label is counted can differ between browsers. An id or a tag-qualified selector also states what kind of element you want.
4. After clicking "Delete", a row should disappear from a table within a few seconds. Which assertion fits?
A negated WebdriverIO matcher retries until the row is gone. Reading isDisplayed() once checks a single moment, a pause guesses, and waitForExist() waits for the opposite.
5. Which page-object getter follows the WebdriverIO convention?
Returning an un-awaited $ keeps the lookup lazy: it runs, with auto-waiting, when the spec calls a command or passes it to expect. The protocol-level findElement skips all of that.
6. Your cloud config has three capabilities and four spec files, and maxInstances: 2. How many TestingBot sessions does a full run create, and how many run at once?
Each spec file runs in its own worker for each capability, and each worker is one session: 3 times 4. maxInstances caps how many workers run at the same time.
7. Sessions on TestingBot are grouped correctly into a build, but all of them show an unknown result. What is missing?
The grid cannot see your assertions. The service reports each spec file's result to the TestingBot API when the file finishes. A name or a reporter does not change the session's state.
8. A pull request's check is red. In the TestingBot dashboard every CI run lands in the same build, so you cannot tell which sessions belong to this pull request. What do you change in the workflow?
A build name that is unique per workflow run gives each run its own build in the dashboard. Describe titles become session names, parallelism changes nothing about grouping, and the artefact lives in GitHub, not in the dashboard.
9. You are in a browser.debug() REPL and type await $('h2').getText(). You get a SyntaxError. What do you type instead?
The WebdriverIO REPL evaluates each line and waits for a returned promise itself, so commands are typed without await.
You finished WebdriverIO Tutorial for Web Testing
Put what you learned into practice. Run your tests on 6100+ real browsers and physical iOS and Android devices.