JavaScript Navigator webdriver Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.webdriver is a read-only boolean that tells you whether the browser is controlled by automation (WebDriver). Co-operating agents set it so pages can take alternate paths during tests (MDN).

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.webdriver. Start with this line.

JavaScript
navigator.webdriver
CallWhat it does
navigator.webdriverPrimary signature.

Built into the browser. Read navigator.webdriver on Navigator — no import required.

Library declarations
JavaScript
navigator.webdriver

Parameters

ParameterDescription
Boolean valueRequired. true = controlled by WebDriver
Secure contextOptional. Works on HTTP and HTTPS
Write accessOptional. Read-only — do not assign

Return Value

Return ValueDescription
*The current value of navigator.webdriver.

JavaScript Examples

Example 1 — Read navigator.webdriver

Print the boolean in the current browser.

JavaScript
console.log(navigator.webdriver);
console.log("automated: " + (navigator.webdriver === true));
Try It Yourself

How It Works

  1. Read the property. No arguments — just navigator.webdriver.
  2. Boolean result. Usually false when you browse yourself.
  3. Strict check. Compare to true if you want a clear yes/no.
  4. Read-only. You observe the flag; you do not set it from page script.

Example 2 — Alternate Path for Automation

Skip noisy UI when tests control the browser.

JavaScript
function startApp() {
  if (navigator.webdriver) {
    console.log("automation mode: skip tour");
    return;
  }
  console.log("normal mode: show tour");
}

startApp();
Try It Yourself

How It Works

  1. Branch on truthiness. true means automation is in control.
  2. Quiet path. Skip tours, confirmations, or animations that flake in CI.
  3. Normal path. Keep the full UX for real users.
  4. MDN intent. This is the co-operating alternate code path pattern.

Example 3 — Label the Session

Build a short status string for logs or a debug panel.

JavaScript
const mode = navigator.webdriver ? "automated" : "interactive";
const info = {
  webdriver: !!navigator.webdriver,
  mode: mode,
  userAgent: navigator.userAgent.slice(0, 40) + "…"
};

console.log(JSON.stringify(info, null, 2));
Try It Yourself

How It Works

  1. Map to a label. Ternary chooses automated vs interactive.
  2. Normalize. !!navigator.webdriver keeps a clean boolean in the object.
  3. Optional context. Include a short UA snippet for debug logs.
  4. Use case. Handy in CI dumps and support diagnostics.

Browser Support

navigator.webdriver is Baseline Widely available (MDN: since May 2018). It works across modern browsers and does not require a secure context.

✓ Baseline · Widely available

Navigator.webdriver

Boolean automation signal. True when WebDriver (or equivalent automation flags) controls the browser so pages can take alternate test paths.

Excellent Baseline
Google Chrome Supported · since 2018 era
Full support
Mozilla Firefox Supported · since 2018 era
Full support
Apple Safari Supported · modern versions
Full support
Microsoft Edge Supported · Chromium
Full support
Opera Supported · modern versions
Full support
Internet Explorer Limited / legacy
Partial
webdriver Widely available

Bottom line: Read navigator.webdriver to branch test-friendly behavior. Prefer it for cooperation with automation — not as sole bot detection.

Frequently Asked Questions

A boolean. It is true when the user agent is controlled by automation (WebDriver), and typically false for a normal interactive browser session.
No. MDN marks it Baseline Widely available (since May 2018). It is not Deprecated, Experimental, or Non-standard.
MDN: when Chrome is started with --enable-automation or --headless, or with --remote-debugging-port set to port 0.
MDN: when the marionette.enabled preference is set or the --marionette flag is passed.
No. It is a standard cooperation signal for automation. Sophisticated bots or patched drivers may hide or omit the flag. Prefer it for test/automation code paths, not as your only security check.
No. It is a read-only Navigator property. You read the boolean; you do not assign a new value from page script.

Next: windowControlsOverlay

Continue with the next Navigator property in the JavaScript guide.

windowControlsOverlay tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful