WebdriverIO API Declaration
The `wdio-api-declaration` package was designed to provide API declarations for WebdriverIO, primarily to enable code editor auto-completion, particularly in IDEs like WebStorm. Released at an early version (0.0.3), it targeted very old Node.js environments (version >=0.6.0) and its usage model relied on specific 'External JavaScript library' configurations within IDEs. This package is now considered obsolete, superseded by WebdriverIO's robust native TypeScript support (introduced and significantly enhanced from WebdriverIO v5 onwards) and the officially maintained `@types/webdriverio` package. It has not received updates for many years and offers no functional value for modern WebdriverIO development. Developers should rely on WebdriverIO's built-in type definitions or the `@types` package for contemporary type inference.
Common errors
-
Cannot find name 'browser' or 'driver' or 'element' when using WebdriverIO with TypeScript.
cause Incorrect or missing WebdriverIO type configurations, potentially due to using outdated declarations like `wdio-api-declaration` or not setting up `tsconfig.json` correctly.fixEnsure `wdio-api-declaration` is NOT installed. Check your `tsconfig.json` and ensure it includes `types: ['node', '@wdio/globals/types']` or similar, depending on your WebdriverIO version and setup. Run `npx wdio ts-setup` for automatic `tsconfig.json` configuration if available. -
Property 'url' does not exist on type 'Browser'.
cause Using an outdated or incompatible type declaration for the WebdriverIO `browser` object. `wdio-api-declaration` provides extremely old definitions.fixRemove `wdio-api-declaration`. Upgrade your WebdriverIO setup if necessary and ensure you are using the correct type definitions that ship with WebdriverIO or `@types/webdriverio`. Check your `package.json` for relevant `@wdio` packages and their versions.
Warnings
- gotcha This package (`wdio-api-declaration@0.0.3`) is severely outdated and no longer maintained. It targets extremely old Node.js versions (>=0.6.0) and an ancient WebdriverIO API.
- breaking Using this package will lead to incorrect or missing type definitions for any recent version of WebdriverIO (v5 and above). The API declarations provided are completely out of sync with current WebdriverIO interfaces and commands.
- deprecated The functionality this package aimed to provide is now natively supported and significantly improved within WebdriverIO itself, or via standard `@types` packages for TypeScript.
Install
-
npm install wdio-api-declaration -
yarn add wdio-api-declaration -
pnpm add wdio-api-declaration
Imports
- WebDriver
// This package does not export runtime symbols. // For WebdriverIO types, use `@types/webdriverio` or rely on WebdriverIO's built-in types. // import type { WebDriver } from 'webdriverio';
Quickstart
npm install wdio-api-declaration
// NOTE: This package is obsolete and its usage is not recommended for modern WebdriverIO projects.
// Its original purpose was to provide IDE auto-completion by configuring it as an
// 'External JavaScript library' in IDEs like WebStorm, without requiring code import.
//
// For current WebdriverIO projects (v7+), types are typically inferred automatically
// or provided by `@types/webdriverio` and `@wdio/globals`.
//
// Example of how you would *actually* use WebdriverIO (with modern types):
// import { remote } from 'webdriverio';
//
// async function runTest() {
// const browser = await remote({
// capabilities: {
// browserName: 'chrome'
// }
// });
//
// await browser.url('https://webdriver.io');
// const title = await browser.getTitle();
// console.log(`Page title: ${title}`);
//
// await browser.deleteSession();
// }
//
// runTest().catch(console.error);