or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

binary-info.mdcli.mdindex.mdinstallation-config.mdprocess-management.md
tile.json

binary-info.mddocs/

Binary Information

Access to ChromeDriver binary path, version, and running instance information for integration with Selenium and other automation frameworks.

Capabilities

Binary Path Access

Get the absolute path to the ChromeDriver binary executable.

/**
 * Path to the ChromeDriver binary executable
 * @type {string}
 */
const path;

Usage Examples:

const chromedriver = require('chromedriver');

// Get binary path
console.log('ChromeDriver binary path:', chromedriver.path);
// Example output: '/path/to/node_modules/chromedriver/lib/chromedriver/chromedriver'

// Use with child_process
const { spawn } = require('child_process');
const chromedriverProcess = spawn(chromedriver.path, ['--port=9515']);

// Use with Selenium WebDriver Builder
const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

const service = new chrome.ServiceBuilder(chromedriver.path);
const driver = new webdriver.Builder()
  .forBrowser('chrome')
  .setChromeService(service)
  .build();

Platform-Specific Behavior:

  • Windows: Points to chromedriver.exe in the binary directory
  • macOS/Linux: Points to chromedriver executable in the binary directory
  • Fallback: If local binary doesn't exist, points to system-level binary name
// Platform-specific path resolution
const binaryPath = process.platform === 'win32' 
  ? path.join(__dirname, 'chromedriver', 'chromedriver.exe')
  : path.join(__dirname, 'chromedriver', 'chromedriver');

Version Information

Get the version of the ChromeDriver binary included with this package.

/**
 * Version of the ChromeDriver binary
 * @type {string}
 */
const version;

Usage Examples:

const chromedriver = require('chromedriver');

// Get version information
console.log('ChromeDriver version:', chromedriver.version);
// Example output: '140.0.7339.80'

// Version compatibility checking
const { compareVersions } = require('compare-versions');
if (compareVersions(chromedriver.version, '120.0.0') >= 0) {
  console.log('Using modern ChromeDriver API');
} else {
  console.log('Using legacy ChromeDriver API');
}

// Logging for debugging
console.log(`Starting tests with ChromeDriver ${chromedriver.version}`);

Process Instance Information

Access the currently running ChromeDriver process instance for monitoring and control.

/**
 * Currently running ChromeDriver process instance
 * @type {ChildProcess|null}
 */
const defaultInstance;

Usage Examples:

const chromedriver = require('chromedriver');

// Start ChromeDriver
chromedriver.start(['--port=9515']);

// Monitor the running instance
if (chromedriver.defaultInstance) {
  console.log('Process ID:', chromedriver.defaultInstance.pid);
  console.log('ChromeDriver is running');
  
  // Listen for process events
  chromedriver.defaultInstance.on('exit', (code, signal) => {
    console.log(`ChromeDriver process exited with code ${code}, signal ${signal}`);
  });
  
  chromedriver.defaultInstance.on('error', (error) => {
    console.error('ChromeDriver process error:', error);
  });
  
  // Check if process is still alive
  const isRunning = !chromedriver.defaultInstance.killed;
  console.log('Process is running:', isRunning);
}

// After stopping
chromedriver.stop();
console.log('Default instance after stop:', chromedriver.defaultInstance); // null

Integration Patterns

Selenium WebDriver Integration

ChromeDriver automatically registers itself with selenium-webdriver when required:

// Automatic registration - just require the package
require('chromedriver');

const webdriver = require('selenium-webdriver');
const driver = new webdriver.Builder()
  .forBrowser('chrome')
  .build();

// ChromeDriver binary is automatically available to Selenium

Manual Binary Path Usage

For frameworks that need explicit binary paths:

const chromedriver = require('chromedriver');
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

// Create service with explicit path
const service = new chrome.ServiceBuilder(chromedriver.path)
  .setPort(9515)
  .build();

const driver = new Builder()
  .forBrowser('chrome')
  .setChromeService(service)
  .build();

Environment Path Registration

The package automatically adds the binary directory to the PATH:

// Automatic PATH modification on require
process.env.PATH = path.join(__dirname, 'chromedriver') + path.delimiter + process.env.PATH;

This ensures that:

  • Selenium can find the ChromeDriver binary automatically
  • Other tools can execute chromedriver from the command line
  • The binary is available in the expected location for testing frameworks

Binary Management Details

Download Location

ChromeDriver binaries are downloaded to:

node_modules/chromedriver/lib/chromedriver/
├── chromedriver      (macOS/Linux)
└── chromedriver.exe  (Windows)

Fallback Behavior

If the local binary is not found:

  1. Logs a warning message about the missing binary
  2. Falls back to using the global chromedriver command
  3. Assumes ChromeDriver is installed system-wide or available in PATH
// Fallback logging example
if (!fs.existsSync(chromedriver.path)) {
  console.log('Could not find chromedriver in default path:', chromedriver.path);
  console.log('Falling back to use global chromedriver bin');
}