{"record":{"id":"88f5939e93f268e4","repo":"crewAIInc/crewAI","slug":"selenium-and-webdriver-manager-package-not-fou","errorCode":null,"errorMessage":"`selenium` and `webdriver-manager` package not found, please run `uv add selenium webdriver-manager`","messagePattern":"`selenium` and `webdriver-manager` package not found, please run `uv add selenium webdriver-manager`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/selenium_scraping_tool/selenium_scraping_tool.py","lineNumber":102,"sourceCode":"\n            if click.confirm(\n                \"You are missing the 'selenium' and 'webdriver-manager' packages. Would you like to install it?\"\n            ):\n                import subprocess\n\n                subprocess.run(\n                    [\"uv\", \"pip\", \"install\", \"selenium\", \"webdriver-manager\"],  # noqa: S607\n                    check=True,\n                )\n                from selenium import webdriver\n                from selenium.webdriver.chrome.options import (\n                    Options,\n                )\n                from selenium.webdriver.common.by import (\n                    By,\n                )\n            else:\n                raise ImportError(\n                    \"`selenium` and `webdriver-manager` package not found, please run `uv add selenium webdriver-manager`\"\n                ) from None\n\n        if \"driver\" not in kwargs:\n            if \"options\" not in kwargs:\n                options: Options = Options()\n                options.add_argument(\"--headless\")\n            else:\n                options = kwargs[\"options\"]\n            self.driver = webdriver.Chrome(options=options)\n        else:\n            self.driver = kwargs[\"driver\"]\n\n        self._by = By\n        if cookie is not None:\n            self.cookie = cookie\n\n        if css_element is not None:","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/selenium_scraping_tool/selenium_scraping_tool.py#L84-L120","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Install both packages up front: `uv add selenium webdriver-manager` (or pip install selenium webdriver-manager).","Add them to Dockerfile/CI requirements so the prompt never triggers.","Ensure a Chrome/Chromium binary is also present, since the tool launches webdriver.Chrome right after import."],"exampleFix":"# before (CI, prompt auto-declined)\ntool = SeleniumScrapingTool()  # ImportError\n\n# after\n# Dockerfile:\n#   RUN uv add selenium webdriver-manager \\\n#       && apt-get install -y chromium chromium-driver\ntool = SeleniumScrapingTool()","handlingStrategy":"validation","validationCode":"def selenium_deps_available() -> bool:\n    try:\n        import selenium, webdriver_manager  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif not selenium_deps_available():\n    subprocess.run([\"uv\", \"add\", \"selenium\", \"webdriver-manager\"], check=True)","typeGuard":null,"tryCatchPattern":"try:\n    tool = SeleniumScrapingTool()\nexcept ImportError as e:\n    if \"selenium\" in str(e):\n        raise SystemExit(\"Install first: uv add selenium webdriver-manager\") from e\n    raise","preventionTips":["Declare selenium and webdriver-manager as explicit dependencies in scraping projects.","Include chromium + chromedriver in Docker/CI images alongside the Python packages.","Never rely on the interactive install prompt in automated environments."],"tags":["dependency","import-error","selenium","installation","webdriver"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}