SeleniumHQ/selenium · error · Error::WebDriverError
unknown HTTP verb: #{verb.inspect}
Error message
unknown HTTP verb: #{verb.inspect} What it means
Raised as Error::WebDriverError by the Curb HTTP client adapter (Http::Curb) when the HTTP verb passed to request is not one of :get, :post, :put, :delete, or :head. The adapter maps known verbs to Curl::Easy methods; any other symbol/string falls through the case/when to this error.
Source
Thrown at rb/lib/selenium/webdriver/remote/http/curb.rb:78
# http://github.com/taf2/curb/issues/issue/33
client.head = false
client.delete = false
case verb
when :get
client.http_get
when :post
client.post_body = payload || ''
client.http_post
when :put
client.put_data = payload || ''
client.http_put
when :delete
client.http_delete
when :head
client.http_head
else
raise Error::WebDriverError, "unknown HTTP verb: #{verb.inspect}"
end
create_response client.response_code, client.body_str, client.content_type
end
def client
@client ||= begin
c = Curl::Easy.new
c.max_redirects = MAX_REDIRECTS
c.follow_location = true
c.timeout = timeout if timeout
c.verbose = WebDriver.logger.debug?
c
end
end
end # Curb
end # HttpView on GitHub (pinned to aa36b38e69)
Solutions
- Ensure all registered command verbs are one of :get, :post, :put, :delete, :head (as Symbols).
- If you registered a custom command, verify the verb in the command tuple: [:patch, '/path'] is NOT supported by curb — use :put or switch to the Default (Net::HTTP) adapter.
- Use the Default HTTP adapter (Net::HTTP) if you need broader verb support: Selenium::WebDriver::Remote::Http::Default.new.
Example fix
# before — curb does not support :patch
bridge.add_commands({custom: [:patch, '/session/:session_id/custom']})
# after — use a supported verb, or switch adapter
bridge.add_commands({custom: [:post, '/session/:session_id/custom']})
# or use Default adapter which may support more verbs Defensive patterns
Strategy: validation
Validate before calling
# Validate verb before registering custom commands with curb:
SUPPORTED_VERBS = %i[get post put delete head].freeze
unless SUPPORTED_VERBS.include?(verb)
raise ArgumentError, "curb adapter does not support verb #{verb}"
end Type guard
def curb_supported_verb?(verb) %i[get post put delete head].include?(verb) end
Try / catch
begin
http_client.request(verb, url)
rescue Selenium::WebDriver::Error::WebDriverError => e
raise unless e.message.include?('unknown HTTP verb')
raise "Use Default (Net::HTTP) adapter for verb #{verb}"
end Prevention
- Only use :get, :post, :put, :delete, :head (as Symbols) with the curb adapter.
- Prefer the Default (Net::HTTP) adapter unless you specifically need curb.
- Validate custom command verbs against the adapter's supported set before registration.
When it happens
Trigger: Using the curb adapter with a custom command that registers a non-standard HTTP verb. Passing a String verb like 'GET' instead of Symbol :get (the case uses symbols). A typo or uppercase verb symbol. A command registration bug producing an unexpected verb.
Common situations: Registering custom commands with add_commands using a verb the curb adapter doesn't handle. Switching from the default (Net::HTTP) adapter to curb without verifying all commands use supported verbs. Framework code that builds verbs dynamically producing incorrect values.
Related errors
- Cannot use both :http_client and :client_config
- #{opts.inspect} invalid for #{command.inspect}
- Cannot use both :http_client and :client_config
- Cannot use both :client_config and :open_timeout/:read_timeo
- too many redirects
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/7ab5c322c1b75df3.
Report an issue: GitHub.