{"record":{"id":"19ca99b77092d4c4","repo":"SeleniumHQ/selenium","slug":"unknown-driver-browser-inspect","errorCode":null,"errorMessage":"unknown driver: #{browser.inspect}","messagePattern":"unknown driver: #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/driver.rb","lineNumber":59,"sourceCode":"        # @return [Driver]\n        #\n\n        def for(browser, opts = {})\n          case browser\n          when :chrome, :chrome_headless_shell\n            Chrome::Driver.new(**opts)\n          when :internet_explorer, :ie\n            IE::Driver.new(**opts)\n          when :safari\n            Safari::Driver.new(**opts)\n          when :firefox, :ff\n            Firefox::Driver.new(**opts)\n          when :edge, :microsoftedge, :msedge\n            Edge::Driver.new(**opts)\n          when :remote\n            Remote::Driver.new(**opts)\n          else\n            raise ArgumentError, \"unknown driver: #{browser.inspect}\"\n          end\n        end\n      end\n\n      #\n      # A new Driver instance with the given bridge.\n      # End users should use Selenium::WebDriver.for instead of using this directly.\n      #\n      # @api private\n      #\n\n      def initialize(bridge: nil, listener: nil, **)\n        @devtools = nil\n        bridge ||= create_bridge(**)\n        @bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge\n        add_extensions(@bridge.browser)\n      end\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/driver.rb#L41-L77","documentation":"Selenium::WebDriver.for(browser) dispatches to the matching driver constructor for a fixed set of browser symbols. An unrecognized symbol falls through the case and raises ArgumentError listing the offending value. Supported symbols include :chrome, :internet_explorer/:ie, :safari, :firefox/:ff, :edge/:microsoftedge/:msedge, and :remote.","triggerScenarios":"Calling Selenium::WebDriver.for(:brave), Selenium::WebDriver.for('chrome') (String instead of Symbol), or any symbol outside the supported set.","commonSituations":"Typo in the browser name, passing a String where a Symbol is expected, expecting an unsupported browser (Brave/Opera/Vivaldi) to work directly instead of via :remote with options, using a stale symbol removed in a newer version.","solutions":["Use one of the supported symbols: :chrome, :firefox, :edge, :safari, :ie/:internet_explorer, or :remote.","Pass a Symbol, not a String: Selenium::WebDriver.for(:chrome).","For Chromium-based unsupported browsers, use Selenium::WebDriver.for(:chrome) with Options#binary, or :remote pointing at a compatible endpoint.","Check the current supported list in the Selenium Ruby docs for your version."],"exampleFix":"// before\nSelenium::WebDriver.for('chrome')\nSelenium::WebDriver.for(:brave)\n// after\nSelenium::WebDriver.for(:chrome)\noptions = Selenium::WebDriver::Chrome::Options.new(binary: '/usr/bin/brave')","handlingStrategy":"validation","validationCode":"SUPPORTED = %i[chrome firefox edge safari internet_explorer ie remote ff microsoftedge msedge].freeze\n\nraise ArgumentError, \"unsupported browser #{browser.inspect}\" unless SUPPORTED.include?(browser.to_sym)\nSelenium::WebDriver.for(browser.to_sym)","typeGuard":"def supported_browser?(b)\n  %i[chrome firefox edge safari internet_explorer ie remote ff microsoftedge msedge].include?(b.to_sym)\nend","tryCatchPattern":"begin\n  Selenium::WebDriver.for(browser)\nrescue ArgumentError => e\n  raise unless e.message =~ /unknown driver/\n  Selenium::WebDriver.for(browser.to_sym)\nend","preventionTips":["Pass a Symbol from the supported set.","For Chromium-based browsers, use :chrome with Options#binary or :remote.","Validate user-supplied browser names against a whitelist before calling WebDriver.for."],"tags":["driver","argument","browser","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}