{"record":{"id":"c17c887b7740f70d","repo":"SeleniumHQ/selenium","slug":"you-must-enable-downloads-in-order-to-work-with-do-c17c88","errorCode":null,"errorMessage":"You must enable downloads in order to work with downloadable files.","messagePattern":"You must enable downloads in order to work with downloadable files\\.","errorType":"exception","errorClass":"Error::WebDriverError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rb","lineNumber":66,"sourceCode":"              end\n            end\n          ensure\n            FileUtils.rm_f(\"#{file_name}.zip\")\n          end\n        end\n\n        def delete_downloadable_files\n          verify_enabled\n\n          @bridge.delete_downloadable_files\n        end\n\n        private\n\n        def verify_enabled\n          return if capabilities['se:downloadsEnabled']\n\n          raise Error::WebDriverError, 'You must enable downloads in order to work with downloadable files.'\n        end\n      end # HasFileDownloads\n    end # DriverExtensions\n  end # WebDriver\nend # Selenium\n","sourceCodeStart":48,"sourceCodeEnd":72,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rb#L48-L72","documentation":"The HasFileDownloads extension methods (downloadable_files, download_file, delete_downloadable_files) call verify_enabled, which requires the session capability 'se:downloadsEnabled' to be truthy. If you did not opt into downloads when creating the session, the capability is absent and these methods raise Error::WebDriverError.","triggerScenarios":"Calling driver.downloadable_files / driver.download_file(...) / driver.delete_downloadable_files on a session created without the downloads capability enabled.","commonSituations":"Forgetting to set 'se:downloadsEnabled' => true in capabilities, using a local driver instead of Remote (this is a Grid/Remote feature), capability name typo, older Selenium Grid that does not support it.","solutions":["Enable downloads in capabilities at session creation: caps['se:downloadsEnabled'] = true (or via the appropriate Options).","Use a Remote driver against a Selenium Grid that supports downloads; this is not a local-browser feature.","Upgrade Selenium Grid/server to a version that honors 'se:downloadsEnabled'.","Call verify_enabled-equivalent logic yourself and degrade gracefully if the capability is missing."],"exampleFix":"// before\ncaps = Selenium::WebDriver::Remote::Capabilities.chrome\ndriver = Selenium::WebDriver.for(:remote, capabilities: caps)\ndriver.downloadable_files\n// after\ncaps = Selenium::WebDriver::Remote::Capabilities.chrome\ncaps['se:downloadsEnabled'] = true\ndriver = Selenium::WebDriver.for(:remote, capabilities: caps)\ndriver.downloadable_files","handlingStrategy":"validation","validationCode":"def downloads_enabled?(driver)\n  driver.capabilities['se:downloadsEnabled']\nend\n\nraise 'downloads not enabled' unless downloads_enabled?(driver)\ndriver.downloadable_files","typeGuard":"def downloads_enabled?(capabilities)\n  !!capabilities['se:downloadsEnabled']\nend","tryCatchPattern":"begin\n  driver.downloadable_files\nrescue Selenium::WebDriver::Error::WebDriverError => e\n  raise unless e.message =~ /must enable downloads/\n  warn 'recreate session with se:downloadsEnabled = true'\nend","preventionTips":["Set caps['se:downloadsEnabled'] = true when creating the Remote session if you will use downloads.","Guard download calls with a capability check first.","Remember this is a Remote/Grid feature, not a local-browser capability."],"tags":["downloads","capabilities","remote","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}