Is there a way I can get autocomplete on VS Code for webdriverio?
Other code editors like Intellij provide something like Settings -> Preferences -> Languages & Fram
my understanding is, vscode is built with typescript
and by default it does not support autoComplete(Intellisense) on a package that is built with javascript
. So all the js package creators would provide an @types
file. These @types
file help vscode to find all the function definitions, object properties. etc., etc., of your JS package and show as suggestions. Which in case here is webdriverio
package.
So adding a @types
dependency that is related to your JS package will mostly fix the issue.
i.e.,
npm install @types/webdriverio --save-dev
After adding the package, i started getting the browser object suggestions.
All the above works fine for v4 version of WDIO.
If you are using v5 version: Then as per their official documentation we need to create a jsconfig.json
file on the root directory.
Above answer worked well :
you need to install below dependency :
if you are using webdriverio v4 (for cucumber BDD ) use below
npm install @types/webdriverio@4 --save-dev
or use :
npm install @types/webdriverio --save-dev
VSCode Intellisense
Using @types/webdriverio is not suggested by webdriverio and it is now deprecated: npm WARN deprecated @types/webdriverio@5.0.0: This is a stub types definition. webdriverio provides its own type definitions, so you do not need this installed.
I would suggest to follow the official documentation by WebDriverIO here: