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

cli.mddocs/

Command Line Interface

Direct execution of ChromeDriver binary through the provided CLI wrapper, enabling command-line usage and integration with shell scripts and CI/CD pipelines.

Capabilities

Binary Execution

Execute ChromeDriver directly from the command line with full argument support.

# Direct execution with arguments
chromedriver [arguments]

# Common usage patterns
chromedriver --port=9515
chromedriver --port=9516 --verbose
chromedriver --log-path=./chromedriver.log --log-level=DEBUG

Usage Examples:

# Basic ChromeDriver startup
chromedriver

# Start on custom port
chromedriver --port=9516

# Verbose logging
chromedriver --verbose

# Custom log file and level
chromedriver --log-path=./logs/chromedriver.log --log-level=INFO

# Multiple options
chromedriver --port=9515 --verbose --log-path=./chromedriver.log

NPM Binary Integration

ChromeDriver is automatically added to the NPM binary path, making it available as a command.

# Available in node_modules/.bin/
./node_modules/.bin/chromedriver [arguments]

# Via NPM scripts
npm run chromedriver -- [arguments]

# Direct execution if globally installed
chromedriver [arguments]

NPM Script Integration:

{
  "scripts": {
    "start-chromedriver": "chromedriver --port=9515",
    "chromedriver-verbose": "chromedriver --verbose --log-path=./logs/chromedriver.log",
    "test-setup": "chromedriver --port=9516 &",
    "test": "npm run test-setup && jest && pkill chromedriver"
  }
}

Process Management

The CLI wrapper handles process lifecycle and signal management.

# Process management
chromedriver &          # Run in background
kill -TERM $!           # Graceful shutdown

# Signal handling
SIGTERM → Graceful shutdown
SIGINT  → Immediate termination

Usage Examples:

# Background execution
chromedriver --port=9515 &
CHROMEDRIVER_PID=$!

# Run tests
npm test

# Clean shutdown
kill -TERM $CHROMEDRIVER_PID
wait $CHROMEDRIVER_PID

CLI Implementation Details

Wrapper Script Behavior

The CLI wrapper (bin/chromedriver) performs these operations:

/**
 * CLI wrapper functionality
 * 1. Resolves binary path from the package
 * 2. Spawns ChromeDriver process with passed arguments
 * 3. Pipes stdout/stderr to parent process
 * 4. Handles process termination signals
 */

// Process argument passing
const args = process.argv.slice(2);
const binPath = require(path.join(__dirname, "..", "lib", "chromedriver")).path;
const cp = spawn(binPath, args);

// Stream handling
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);

// Signal handling
process.on("SIGTERM", function() {
  cp.kill("SIGTERM");
  process.exit(1);
});

Path Resolution

The binary path is resolved through the main package module:

# Path resolution chain
bin/chromedriver → lib/chromedriver.js → platform-specific binary path

Platform-Specific Paths:

  • Windows: lib/chromedriver/chromedriver.exe
  • macOS/Linux: lib/chromedriver/chromedriver
  • Fallback: System chromedriver command

Common CLI Arguments

Port Configuration

# Port specification
chromedriver --port=9515        # Custom port
chromedriver --port=0           # Random available port

Logging Configuration

# Logging options
chromedriver --verbose                              # Verbose output
chromedriver --log-path=./chromedriver.log        # Log file
chromedriver --log-level=INFO                     # Log level
chromedriver --silent                             # Minimal output

Network Configuration

# Network binding
chromedriver --whitelisted-ips=127.0.0.1,192.168.1.0/24
chromedriver --allowed-origins=*
chromedriver --allowed-ips=127.0.0.1,192.168.1.100

Security Options

# Security configuration
chromedriver --disable-dev-shm-usage
chromedriver --no-sandbox
chromedriver --disable-extensions
chromedriver --disable-background-timer-throttling

Integration Patterns

CI/CD Pipeline Integration

# GitHub Actions example
- name: Start ChromeDriver
  run: |
    chromedriver --port=9515 &
    echo "CHROMEDRIVER_PID=$!" >> $GITHUB_ENV
    
- name: Run tests
  run: npm test
  
- name: Stop ChromeDriver
  run: kill $CHROMEDRIVER_PID
  if: always()
# GitLab CI example
test:
  script:
    - chromedriver --port=9515 &
    - CHROMEDRIVER_PID=$!
    - npm test
    - kill $CHROMEDRIVER_PID

Docker Integration

# Dockerfile example
FROM node:18

# Install ChromeDriver package
RUN npm install -g chromedriver

# Set up ChromeDriver service
EXPOSE 9515
CMD ["chromedriver", "--port=9515", "--whitelisted-ips=0.0.0.0"]

Shell Script Integration

#!/bin/bash
# test-runner.sh

# Start ChromeDriver in background
chromedriver --port=9515 --log-path=./logs/chromedriver.log &
CHROMEDRIVER_PID=$!

# Wait for ChromeDriver to be ready
sleep 2

# Run tests
echo "Running tests with ChromeDriver PID: $CHROMEDRIVER_PID"
npm test
TEST_RESULT=$?

# Clean up
echo "Stopping ChromeDriver..."
kill -TERM $CHROMEDRIVER_PID
wait $CHROMEDRIVER_PID

exit $TEST_RESULT

Error Handling

Binary Not Found

If the ChromeDriver binary is missing:

Could not find chromedriver in default path: /path/to/binary
Falling back to use global chromedriver bin

The wrapper automatically falls back to the system-installed ChromeDriver.

Port Conflicts

ChromeDriver will report port conflicts:

# Error output
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 9515.

Permission Issues

On macOS, unsigned binaries may require permission:

# macOS permission dialog may appear
# Allow ChromeDriver to run in System Preferences → Security & Privacy

Environment Variables

The CLI wrapper is a simple pass-through script that doesn't process environment variables. All configuration is done through command-line arguments passed directly to the ChromeDriver binary:

# Configuration through command-line arguments only
chromedriver --port=9515 --verbose --log-path=./test.log