SeleniumHQ/selenium · error · Error::WebDriverError
could not find extension at #{path.inspect}
Error message
could not find extension at #{path.inspect} What it means
Raised by Firefox::Extension.new (Error::WebDriverError) when the given path does not exist on disk (File.exist?(path) is false). The constructor expects a real directory or an archive file (.xpi/.zip) for the Firefox extension to install.
Source
Thrown at rb/lib/selenium/webdriver/firefox/extension.rb:31
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
module Selenium
module WebDriver
module Firefox
#
# @api private
#
class Extension
NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'
def initialize(path)
raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.exist?(path)
@path = path
@should_reap_root = false
end
def write_to(extensions_dir)
root_dir = create_root
ext_path = File.join extensions_dir, read_id(root_dir)
FileUtils.rm_rf ext_path
FileUtils.mkdir_p File.dirname(ext_path), mode: 0o700
FileUtils.cp_r root_dir, ext_path
FileReaper.reap(root_dir) if @should_reap_root
end
private
View on GitHub (pinned to aa36b38e69)
Solutions
- Verify the path with File.exist?(path) before constructing the Extension / calling add_extension.
- Use an absolute path (File.expand_path) so resolution does not depend on the current working directory.
- Confirm the extension file is actually packaged/copied into the expected location in CI.
Example fix
// before
profile.add_extension('extensions/myext.xpi') # file missing in CI
// after
ext_path = File.expand_path('extensions/myext.xpi', __dir__)
raise "extension not found: #{ext_path}" unless File.exist?(ext_path)
profile.add_extension(ext_path) Defensive patterns
Strategy: validation
Validate before calling
ext_path = File.expand_path(path)
raise "extension missing: #{ext_path}" unless File.exist?(ext_path)
profile.add_extension(ext_path) Prevention
- Resolve paths with File.expand_path to avoid working-directory issues.
- Check File.exist?(path) before constructing an Extension or calling add_extension.
- Ensure extension artifacts are copied into place in CI before the test run.
When it happens
Trigger: Calling Profile#add_extension(path) or installing an addon with a path that points to a nonexistent file/directory; a typo in the path; a relative path resolved against the wrong working directory.
Common situations: Bundled extension path computed at runtime that doesn't match the deployed layout; CI running from a different working directory than local; path built via string interpolation that yields nil (e.g. "#{nil}/ext.xpi").
Related errors
- Couldn't find manifest.json in ${extension}
- Could not find add-on ID for ${extension}
- Add-on path does not exist: {addon_path}
- expected #{Zipper::EXTENSIONS.join(' or ')}, got #{@path.ins
- cannot locate extension id in #{rdf_path}
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/21687da2cd1ca34a.
Report an issue: GitHub.