SeleniumHQ/selenium · critical · Error::WebDriverError

unsupported platform: #{Platform.os}

Error message

unsupported platform: #{Platform.os}

What it means

Raised by SeleniumManager.platform_location when the runtime OS cannot be classified as Windows, Mac, Linux, or generic Unix. The Selenium Manager binary is only bundled for those platforms; if Platform.os returns something unrecognized (e.g., a niche or embedded OS), the driver-path resolution fails at startup with WebDriverError.

Source

Thrown at rb/lib/selenium/webdriver/common/selenium_manager.rb:86

          validate_command_result(command, status, result, stderr)

          result
        end

        def platform_location
          directory = File.expand_path(bin_path, __FILE__)
          if Platform.windows?
            "#{directory}/windows/selenium-manager.exe"
          elsif Platform.mac?
            "#{directory}/macos/selenium-manager"
          elsif Platform.linux?
            "#{directory}/linux/selenium-manager"
          elsif Platform.unix?
            WebDriver.logger.warn('Selenium Manager binary may not be compatible with Unix',
                                  id: %i[selenium_manager unix_binary])
            "#{directory}/linux/selenium-manager"
          else
            raise Error::WebDriverError, "unsupported platform: #{Platform.os}"
          end
        end

        def execute_command(*command)
          WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager)

          Open3.capture3(*command)
        rescue StandardError => e
          raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
        end

        def parse_result_and_log(stdout)
          json_output = stdout.empty? ? {'logs' => [], 'result' => {}} : JSON.parse(stdout)

          json_output['logs'].each do |log|
            level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase
            WebDriver.logger.send(level, log['message'], id: :selenium_manager)
          end

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Set the SE_MANAGER_PATH environment variable to point to a compatible selenium-manager binary for your platform.
  2. Specify the driver path explicitly via Service.driver_path= or options to bypass Selenium Manager entirely.
  3. Verify Platform.os output in your environment (e.g., in IRB: require 'selenium-webdriver'; Selenium::WebDriver::Platform.os) and report if it should be classified as unix/linux.

Example fix

// before
# Selenium Manager auto-detection fails on unsupported OS
options = Selenium::WebDriver::Options.chrome

// after (set SE_MANAGER_PATH)
ENV['SE_MANAGER_PATH'] = '/usr/local/bin/selenium-manager'
options = Selenium::WebDriver::Options.chrome

// after (bypass Selenium Manager with explicit driver path)
Selenium::WebDriver::Service.chrome(driver_path: '/path/to/chromedriver')
Defensive patterns

Strategy: validation

Validate before calling

# Pre-flight check: ensure platform is supported or SE_MANAGER_PATH is set
unless %w[linux macos windows].any? { |p| Selenium::WebDriver::Platform.os.to_s.include?(p) } ||
       Selenium::WebDriver::Platform.unix? || Selenium::WebDriver::Platform.windows? ||
       ENV.key?('SE_MANAGER_PATH')
  raise 'Unsupported platform for Selenium Manager. Set SE_MANAGER_PATH or specify driver_path manually.'
end

Try / catch

begin
  driver = Selenium::WebDriver.for :chrome
rescue Selenium::WebDriver::Error::WebDriverError => e
  raise unless e.message.include?('unsupported platform')
  # fall back to explicit driver path
  service = Selenium::WebDriver::Service.chrome(driver_path: ENV.fetch('CHROMEDRIVER_PATH'))
  driver = Selenium::WebDriver.for(:chrome, service: service)
end

Prevention

When it happens

Trigger: Running on an exotic or embedded platform (e.g., AIX, Solaris with a host triplet not matching linux/unix/mac/windows). Running on a minimal container where Platform.os misidentifies the OS. Running on a new architecture where Platform heuristics fail.

Common situations: CI on unusual Docker base images. Cross-compilation or emulated environments. Running on BSD variants where Platform.unix? might not return true.

Related errors


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