Skip to content

FirefoxBinary import breaks runtime with Selenium 4 despite selenium>=4 requirement #222

@FernandoCelmer

Description

@FernandoCelmer

Summary

There is a fundamental dependency incompatibility that makes tbselenium unusable with any version of Selenium:

  • tbselenium declares selenium >= 4 as a requirement (enforced by package managers like Poetry/pip)
  • But the internal code still imports FirefoxBinary from selenium.webdriver.firefox.firefox_binary, which was removed in Selenium 4

This creates an impossible situation:

Scenario Result
Use Selenium 4.x (as required by tbselenium) ModuleNotFoundError: No module named 'selenium.webdriver.firefox.firefox_binary' at runtime
Downgrade to Selenium 3.141.0 Package manager rejects it — tbselenium declares selenium>=4

There is no valid pair of (selenium version, tbselenium version) that satisfies both the declared dependency constraint and works at runtime.

Reproduction

pip install tbselenium selenium
python -c "from tbselenium.tbdriver import TorBrowserDriver"
# ModuleNotFoundError: No module named 'selenium.webdriver.firefox.firefox_binary'

Or with Poetry:

[tool.poetry.dependencies]
selenium = "3.141.0"   # Works at runtime but Poetry rejects: tbselenium requires >=4
tbselenium = "0.6.3"
[tool.poetry.dependencies]
selenium = "^4"        # Accepted by Poetry, but crashes at runtime on import
tbselenium = "0.6.3"

Root Cause

FirefoxBinary was removed from Selenium in version 4.0. The tbselenium codebase has not been updated to remove this import or adapt to Selenium 4's API (which uses options.binary_location instead).

Expected Fix

  • Remove the FirefoxBinary import and replace usage with options.binary_location (Selenium 4 API)
  • Update any other Selenium 3-only APIs used internally (e.g., executable_path in WebDriver constructors was also removed in Selenium 4.10+)

Environment

  • Python 3.12
  • selenium 4.x (latest)
  • tbselenium 0.6.3 / 0.9.0 (both affected)
  • Tested on macOS and Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions