Skip to main content

Getting Started

Welcome to the WebdriverIO documentation. It will help you to get started fast. If you run into problems, you can find help and answers on our Matrix Support Channel or you can hit me on Twitter.

info

These are the docs for the latest version (>=8.x) of WebdriverIO. If you are still using an older version, please visit the old documentation websites!

Initiate a WebdriverIO Setup​

To add a full WebdriverIO setup to an existing or new project using the WebdriverIO Starter Toolkit, run:

If you're in the root directory of an existing project, run:

npm init wdio .

or if you want to create a new project:

npm init wdio ./path/to/new/project

This single command downloads the WebdriverIO CLI tool and runs a configuration wizard that helps you to configure your test suite.

The wizard will prompt a set questions that guides you through the setup. You can pass a --yes parameter to pick a default set up which will use Mocha with Chrome using the Page Object pattern.

npm init wdio . -- --yes

Run Test​

You can start your test suite by using the run command and pointing to the WebdriverIO config that you just created:

npx wdio run ./wdio.conf.js

If you like to run specific test files you can add a --spec parameter:

npx wdio run ./wdio.conf.js --spec example.e2e.js

or define suites in your config file and run just the test files defined by in a suite:

npx wdio run ./wdio.conf.js --suite exampleSuiteName

Run in a script​

If you would like to use WebdriverIO as an automation engine in Standalone Mode within a Node.JS script you can also directly install WebdriverIO and use it as a package, e.g. to generate a screenshot of a website:

getting-started/run-in-script.js
loading...

Note: all WebdriverIO commands are asynchronous and need to be properly handled using async/await.

Record tests​

WebdriverIO provides tools to help you get started by recording your test actions on screen and generate WebdriverIO test scripts automatically. See Recorder tests with Chrome DevTools Recorder for more information.

System Requirements​

You’ll need Node.js installed.

  • Install at least v16.x or higher as this is the oldest active LTS version
  • Only releases that are or will become an LTS release are officially supported

If you don't have Node installed, we recommend installing NVM to assist managing multiple active Node.js versions.