crewAIInc/crewAI · error · ImportError

`selenium` and `webdriver-manager` package not found, please

Error message

`selenium` and `webdriver-manager` package not found, please run `uv add selenium webdriver-manager`

What it means

ImportError raised by SeleniumScrapingTool when neither selenium nor webdriver-manager is importable and the interactive click.confirm install prompt is declined or unavailable. The tool offers to run `uv pip install selenium webdriver-manager`; on 'no' (or in non-interactive contexts) it raises with the exact `uv add` command in the message. It fires during tool setup, before any browser is launched.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/selenium_scraping_tool/selenium_scraping_tool.py:102

            if click.confirm(
                "You are missing the 'selenium' and 'webdriver-manager' packages. Would you like to install it?"
            ):
                import subprocess

                subprocess.run(
                    ["uv", "pip", "install", "selenium", "webdriver-manager"],  # noqa: S607
                    check=True,
                )
                from selenium import webdriver
                from selenium.webdriver.chrome.options import (
                    Options,
                )
                from selenium.webdriver.common.by import (
                    By,
                )
            else:
                raise ImportError(
                    "`selenium` and `webdriver-manager` package not found, please run `uv add selenium webdriver-manager`"
                ) from None

        if "driver" not in kwargs:
            if "options" not in kwargs:
                options: Options = Options()
                options.add_argument("--headless")
            else:
                options = kwargs["options"]
            self.driver = webdriver.Chrome(options=options)
        else:
            self.driver = kwargs["driver"]

        self._by = By
        if cookie is not None:
            self.cookie = cookie

        if css_element is not None:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install both packages up front: `uv add selenium webdriver-manager` (or pip install selenium webdriver-manager).
  2. Add them to Dockerfile/CI requirements so the prompt never triggers.
  3. Ensure a Chrome/Chromium binary is also present, since the tool launches webdriver.Chrome right after import.

Example fix

# before (CI, prompt auto-declined)
tool = SeleniumScrapingTool()  # ImportError

# after
# Dockerfile:
#   RUN uv add selenium webdriver-manager \
#       && apt-get install -y chromium chromium-driver
tool = SeleniumScrapingTool()
Defensive patterns

Strategy: validation

Validate before calling

def selenium_deps_available() -> bool:
    try:
        import selenium, webdriver_manager  # noqa: F401
        return True
    except ImportError:
        return False

if not selenium_deps_available():
    subprocess.run(["uv", "add", "selenium", "webdriver-manager"], check=True)

Try / catch

try:
    tool = SeleniumScrapingTool()
except ImportError as e:
    if "selenium" in str(e):
        raise SystemExit("Install first: uv add selenium webdriver-manager") from e
    raise

Prevention

When it happens

Trigger: Constructing/calling SeleniumScrapingTool in an environment missing selenium or webdriver-manager: the initial import fails, the confirm prompt appears, and is declined (automatically in CI/Docker where stdin is not a TTY).

Common situations: CI pipelines and Docker containers without the optional browser deps; fresh venvs where crewai-tools was installed without its selenium extras; headless servers where the prompt cannot be answered.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/88f5939e93f268e4. Report an issue: GitHub.