SeleniumHQ/selenium · critical · Error::WebDriverError

Unsuccessful command executed: #{command}; #{e.message}

Error message

Unsuccessful command executed: #{command}; #{e.message}

What it means

Raised by SeleniumManager.execute_command when Open3.capture3 fails to spawn or run the selenium-manager binary with a StandardError (e.g., Errno::ENOENT if the binary does not exist, Errno::EACCES if not executable, or ENOMEM). This wraps the underlying OS error into a WebDriverError with the original message appended.

Source

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

          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

          json_output['result']
        end

        def validate_command_result(command, status, result, stderr)
          if status.nil? || status.exitstatus.nil?
            WebDriver.logger.info("No exit status for: #{command}. Assuming success if result is present.",
                                  id: :selenium_manager)
          end

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Verify the binary exists and is executable: check rb/lib/selenium/webdriver/common/../../../bin/<platform>/selenium-manager.
  2. Reinstall the selenium-webdriver gem cleanly: gem install selenium-webdriver.
  3. Set SE_MANAGER_PATH to a known-good binary location.
  4. Fix permissions: chmod +x on the binary.
  5. Bypass Selenium Manager by specifying the driver path explicitly in your Service configuration.

Example fix

// before
# Binary missing or not executable, raises on driver launch

// after (fix permissions)
chmod +x bin/linux/selenium-manager

// after (bypass)
Selenium::WebDriver::Service.chrome(driver_path: '/usr/bin/chromedriver')
Defensive patterns

Strategy: try-catch

Validate before calling

# Verify selenium-manager binary exists and is executable before driver launch
binary_dir = File.expand_path('../../../bin', __dir__)
platform_dir = case
               when Selenium::WebDriver::Platform.windows? then 'windows'
               when Selenium::WebDriver::Platform.mac? then 'macos'
               when Selenium::WebDriver::Platform.linux? then 'linux'
               end
binary = File.join(binary_dir, platform_dir, 'selenium-manager')
binary += '.exe' if Selenium::WebDriver::Platform.windows?
unless File.executable?(binary)
  raise "selenium-manager binary not executable at #{binary}. Set SE_MANAGER_PATH or fix permissions."
end

Try / catch

begin
  driver = Selenium::WebDriver.for :chrome
rescue Selenium::WebDriver::Error::WebDriverError => e
  raise unless e.message.include?('Unsuccessful command executed')
  # binary execution failed; fall back to manual driver path
  service = Selenium::WebDriver::Service.chrome(driver_path: '/usr/local/bin/chromedriver')
  driver = Selenium::WebDriver.for(:chrome, service: service)
end

Prevention

When it happens

Trigger: The selenium-manager binary is missing from the gem's bin directory (corrupt install). The binary exists but lacks execute permission. The binary path from SE_MANAGER_PATH points to a nonexistent file. The system is out of memory or out of process slots.

Common situations: Partial or corrupt gem installation (e.g., git clone without submodules). Filesystem permissions after extracting a tarball that dropped the executable bit. Running inside a restricted container where process spawning is limited. SELinux/AppArmor blocking execution.

Related errors


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