SeleniumHQ/selenium · error · Error

Do not know how to build driver: ${browser}; did you forget

Error message

Do not know how to build driver: ${browser}; did you forget to call usingServer(url)?

What it means

Thrown by Builder.build() in index.js when the resolved browser name does not match any native browser case (Chrome, Firefox, IE, Edge, Safari) in the switch statement and no remote server URL is configured. The default case fires. The hint 'did you forget to call usingServer(url)?' indicates non-native browsers require a remote Grid.

Source

Thrown at javascript/selenium-webdriver/index.js:719

        if (this.ieService_) {
          service = this.ieService_.build()
        }
        return createDriver(ie.Driver, capabilities, service)
      }

      case Browser.EDGE: {
        let service = null
        if (this.edgeService_) {
          service = this.edgeService_.build()
        }
        return createDriver(edge.Driver, capabilities, service)
      }

      case Browser.SAFARI:
        return createDriver(safari.Driver, capabilities)

      default:
        throw new Error('Do not know how to build driver: ' + browser + '; did you forget to call usingServer(url)?')
    }
  }
}

/**
 * In the 3.x releases, the various browser option classes
 * (e.g. firefox.Options) had to be manually set as an option using the
 * Capabilities class:
 *
 *     let ffo = new firefox.Options();
 *     // Configure firefox options...
 *
 *     let caps = new Capabilities();
 *     caps.set('moz:firefoxOptions', ffo);
 *
 *     let driver = new Builder()
 *         .withCapabilities(caps)
 *         .build();

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Call Builder.usingServer(gridUrl) for browsers without native driver support.
  2. Verify the browser name matches a Browser enum value (Browser.CHROME, Browser.FIREFOX, etc.).
  3. Use forBrowser(Browser.CHROME) with the enum constant to avoid typos.
  4. If targeting a Grid, ensure SELENIUM_REMOTE_URL or usingServer() is set.

Example fix

// before
new Builder().forBrowser('opera').build()
// after
new Builder().forBrowser('opera').usingServer('http://grid.example.com:4444').build()
Defensive patterns

Strategy: validation

Validate before calling

const { Browser } = require('selenium-webdriver')
const NATIVE_BROWSERS = new Set([
  Browser.CHROME, Browser.FIREFOX, Browser.INTERNET_EXPLORER,
  Browser.EDGE, Browser.SAFARI,
])
function buildDriverSafe(builder, browser, gridUrl) {
  if (!NATIVE_BROWSERS.has(browser) && !gridUrl) {
    throw new Error(`Browser '${browser}' requires usingServer(gridUrl) because it has no native driver`)
  }
  return builder.forBrowser(browser).build()
}

Prevention

When it happens

Trigger: Setting forBrowser('opera') or forBrowser('brave') without calling usingServer(). Typo in the browser name. Using a browser name not in the supported native set. SELENIUM_BROWSER env var set to an unsupported value.

Common situations: Using Opera/Brave/other Chromium derivatives that need a remote Grid; misspelling 'chrome' or 'firefox'; forgetting to configure the remote URL when targeting a Grid-only browser.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/9f4ed6c23ea50550. Report an issue: GitHub.