SeleniumHQ/selenium · error · Error::WebDriverError

not executable: #{path.inspect}

Error message

not executable: #{path.inspect}

What it means

assert_executable first calls assert_file, then checks the executable permission bit. If the file exists but is not executable, it raises WebDriverError. This validates driver binaries (e.g. chromedriver) before Selenium tries to launch them.

Source

Thrown at rb/lib/selenium/webdriver/common/platform.rb:144

        path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
      end

      def make_writable(file)
        File.chmod 0o766, file
      end

      def assert_file(path)
        return if File.file? path

        raise Error::WebDriverError, "not a file: #{path.inspect}"
      end

      def assert_executable(path)
        assert_file(path)

        return if File.executable? path

        raise Error::WebDriverError, "not executable: #{path.inspect}"
      end

      def exit_hook
        pid = Process.pid

        at_exit { yield if Process.pid == pid }
      end

      def localhost
        info = Socket.getaddrinfo 'localhost', 80, Socket::AF_INET, Socket::SOCK_STREAM

        return info[0][3] unless info.empty?

        raise Error::WebDriverError, "unable to translate 'localhost' for TCP + IPv4"
      end

      def ip
        orig = Socket.do_not_reverse_lookup

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Make the binary executable: chmod +x /path/to/chromedriver.
  2. Re-download/extract the driver with a tool that preserves the execute bit.
  3. Verify with File.executable?(path) before configuring the driver path.

Example fix

# before
# chromedriver downloaded without execute permission

# after
chmod +x /usr/local/bin/chromedriver
Defensive patterns

Strategy: validation

Validate before calling

File.chmod(0o755, path) unless File.executable?(path)

Type guard

def executable?(path)
  File.file?(path) && File.executable?(path)
end

Try / catch

begin
  Selenium::WebDriver.for(:chrome)
rescue Selenium::WebDriver::Error::WebDriverError => e
  raise unless e.message.include?('not executable')
  File.chmod(0o755, path)
  Selenium::WebDriver.for(:chrome)
end

Prevention

When it happens

Trigger: A driver binary was downloaded but never made executable. The file is owned by another user without execute permission. Running on a system that strips the execute bit (some unzip/extract tools).

Common situations: Freshly downloaded driver on Linux/macOS without chmod +x. CI image that copied the binary without preserving permissions. Permissions reset after a git checkout.

Related errors


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