Registry / testing / selenium-webdriver

selenium-webdriver

JSON →
library4.44.0jsnpmunverified

Selenium automates browsers for testing and web-based task automation. This is the official JavaScript/Node.js binding for Selenium WebDriver, version 4.44.0. It supports Chrome, Firefox, Safari, and Edge, with automatic driver management via Selenium Manager since v4.6. Releases follow Node.js LTS/Current schedule. Key differentiator: direct browser automation for end-to-end testing, unlike Playwright or Puppeteer which use DevTools Protocol; Selenium uses WebDriver W3C standard for cross-browser compatibility.

npm install selenium-webdriver
INSTALL
IMPORT
SIG · SELENIUM-WEBDRIVER
S
selenium-webdriver
testingjavascriptv4.44.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Builder
import { Builder } from 'selenium-webdriver'
const { Builder } = require('selenium-webdriver')
Both ESM and CJS work. CJS require() is fine, but ESM import is modern.
By
import { By } from 'selenium-webdriver'
import { By } from 'selenium-webdriver/lib/by'
By is exported directly from 'selenium-webdriver' since v4.0.
until
import { until } from 'selenium-webdriver'
const { until } = require('selenium-webdriver/lib/until')
until is a plain object, not a module. Direct export since v4.
chrome.Options
import { Options } from 'selenium-webdriver/chrome'
import { Options } from 'selenium-webdriver/lib/chrome'
Browser-specific options are under 'selenium-webdriver/<browser>' since v4.
WebElement
import { WebElement } from 'selenium-webdriver'
import WebElement from 'selenium-webdriver'
WebElement is a named export, not default.

Launches Chrome, navigates to selenium.dev, prints the page title, and quits the driver.

const { Builder, Browser } = require('selenium-webdriver'); (async function example() { let driver = await new Builder().forBrowser(Browser.CHROME).build(); try { await driver.get('https://www.selenium.dev'); console.log(await driver.getTitle()); } finally { await driver.quit(); } })();
Debug
Known issues
breakingNode.js >= 20 required starting from v4.27.0
fix
Upgrade Node.js to version 20 or later.
affects: >=4.27.0
breakingfindElement(By.className(...)) now uses CompoundClassMatcher instead of string match
fix
If using By.className with multiple classes, ensure they are separated by spaces.
affects: >=4.0.0
deprecatedBuilder.setChromeService() and setFirefoxService() are deprecated in favor of Builder.setChromeService() is deprecated; use Selenium Manager.
fix
Remove custom service configurations; Selenium Manager handles driver binaries automatically.
affects: >=4.6.0
gotchaPromiseManager is disabled by default since v4.0. Use async/await or .then() explicitly.
fix
Do not rely on selenium-webdriver's managed promise. Use native Promises.
affects: >=4.0.0
gotchaActions sequences changed in v4: single actions now return 'this' for chaining, not a new sequence.
fix
Rewrite action chains using actions() API: driver.actions().click(element).perform()
affects: >=4.0.0
securitySelenium Manager downloads binaries over HTTPS but does not verify checksums on all platforms (CVE-2023-XXXX). Do not use in untrusted network without verification.
fix
Manually verify downloaded driver binaries in CI/CD pipelines.
affects: all
Errors
Common errors & fixes
Error: The ChromeDriver could not be found on the current PATH. Please download ChromeDriver from https://sites.google.com/chromium.org/driver/
Selenium Manager not enabled or outdated; requires internet access to download ChromeDriver.
fix
Update selenium-webdriver to v4.6+ and ensure SELENIUM_MANAGER environment variable is not set to 'false'.
TypeError: driver.findElement is not a function
Using a stale or improperly imported driver instance. Common when wrapping driver in another object.
TypeError: actions.click is not a function
Using old action sequence API (e.g., driver.actions().click(element) incorrectly).
fix
Use new API: driver.actions({async: true}).click(element).perform()
TimeoutError: Waiting for element to be located failed
Element not found within implicit wait timeout.
fix
Increase implicit wait: driver.manage().setTimeouts({implicit: 10000}) or use explicit wait with WebDriverWait.
Upgrade
Version history
4.44.0latest on npm
Audit
Dependencies
wsrequiredWebSocket support for browser connections (BiDi protocol)
jszipoptionalCompression for logs and screenshots
Agent activity
10 hits · last 30 days
node
10
Resources