# Fix "TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'"

Yes. An agent moves a Selenium 3 script to Service objects and By locators, fixes the chromedriver download that stopped at Chrome 114, and tests it headless.

[Run this on Rush](https://cloud.getrush.ai/run/fix-webdriver-executable-path-unexpected-keyword-argument/selenium/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

Selenium 4.10.0 removed `executable_path` from `webdriver.Chrome(...)`. On 4.9.1 the constructor still lists `executable_path='chromedriver'`, `chrome_options`, `desired_capabilities` and `service_log_path`, and warns `executable_path has been deprecated, please pass in a Service object`; from 4.10.0 it takes `options`, `service` and `keep_alive` only, and the current 4.52.0 raises the title's `TypeError`, with the same message for `chrome_options`. The driver path moved to `Service(executable_path=...)`. An older cut, 4.3.0, removed `find_element_by_id` and the rest of the `find_element_by_*` family that 4.2.0 still has. A Selenium 3 script with no pin fails at the constructor, then at its first locator.

aau-zid/BigBlueButton-liveStreaming streams a BigBlueButton meeting to an RTMP server from a Docker image. `py_requirements.txt` lists `selenium` with no version, beside `bigbluebutton-api-python` and `redis`, and the Dockerfile installs it with `pip install --no-cache-dir -r py_requirements.txt`. The repository has two Selenium scripts in different states. `stream.py` line 152 already builds its browser with `webdriver.Chrome(service=Service('./chromedriver'), options=options)` and finds the chat box with `browser.find_element(By.ID, 'message-input')` on line 176. `chat.py`, which relays Redis messages into the meeting chat, still has `webdriver.Chrome(executable_path='./chromedriver',options=options)` on line 67 and `find_element_by_id` and `find_elements_by_css_selector` on lines 90, 91, 106 and 107. `startStream.sh` starts `chat.py` under `xvfb-run` only when `BBB_ENABLE_CHAT=true`, so a stream without chat runs and one with chat dies at start-up.

There is a second break in the same image. The Dockerfile installs `google-chrome-stable` from Google's apt repository, reads its version, and downloads a matching driver from `https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER`. That bucket stopped at Chrome 114: `LATEST_RELEASE_114` answers `114.0.5735.90`, while `LATEST_RELEASE_115` and `LATEST_RELEASE_142` answer an XML `NoSuchKey` error, so the `wget` and `unzip` that follow have no driver to fetch on a rebuild. Selenium 4.52 ships Selenium Manager, a binary under `selenium/webdriver/common/linux-x86_64` in the installed package, which locates or fetches a driver for the installed browser when `Service()` is given no path, and that is the simplest replacement for the download step.

The agent cannot join a meeting: it has no BigBlueButton server or secret and is told not to look for one. It reproduces the two errors with a few lines against the installed Selenium, ports `chat.py` to the same shape `stream.py` already uses, with `Service`, `By.ID` and `By.CSS_SELECTOR` (the `By` import is already on line 11), and then tests the browser code it can test: it starts headless Chrome in the sandbox through Selenium Manager, opens a local HTML page with an input whose id is `message-input` and a button labelled `Send message`, and runs the ported `find_element` and `find_elements` calls plus `send_keys` and `click` against it. The sandbox has no Docker, so it does not build the image; it reproduces the `pip install` from the Dockerfile in a virtual environment and leaves the image build for CI.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "This repository's Selenium scripts fail on a fresh install with TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'. Read the requirements file and the Dockerfile and report how selenium is specified and how the browser driver is obtained. In a clean virtual environment install the requirements, report the installed selenium version, and reproduce the error with a minimal call. Find every webdriver constructor call, every executable_path or chrome_options argument, and every find_element_by_* or find_elements_by_* call, with file and line, in all Python files. Port them to the Selenium 4 API: a Service object for the driver path, options= for the options, and find_element(By.X, ...) / find_elements(By.X, ...), matching the style any already-ported file in the repository uses. Check with curl whether the driver download URL in the Dockerfile still answers for the installed Chrome version, and if it does not, replace the download with Selenium Manager or a current source, and say which. Do not connect to any BigBlueButton server and do not use any secret. Test the ported locator code against a local HTML page in headless Chrome and include the output. Do not build the Docker image. Open a pull request listing each change by file and line, the selenium versions at which each removed argument and method disappeared as you observed them, and what still needs a real meeting to verify.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

A pull request that changes `chat.py`, the Dockerfile's driver step and, if the team wants it, a lower bound on `selenium` in `py_requirements.txt`. The description starts with the two tracebacks on the installed release and a short table of what disappeared when, as the agent observed it in the sandbox, so the reviewer sees why a script that worked for years broke on a rebuild and not on a code change.

The record of the run holds the `curl` of the driver bucket, the minimal reproduction, the headless Chrome start through Selenium Manager and the locator test's output on the local page. The pull request says in its first lines what was not tested: joining a meeting, the Redis relay and the chat send on a real BigBlueButton page.

Before merging, a reviewer builds the image in CI, sets `BBB_ENABLE_CHAT=true` against a test meeting and watches `chat.py` post its greeting. That is the one step the sandbox could not do, and the pull request names it.

## Run it on every pull request

An automation on the Project with a `github` trigger on `pull_request.opened` and `pull_request.synchronize`, with a prompt that asks for the Selenium check above on each pull request that touches `py_requirements.txt`, the Dockerfile or a Python file, catches the next removed argument before it reaches the image. The trigger adds the pull request to the prompt; it fills in no placeholder, and a pull request opened by a bot fires no `github` trigger.

Dependency bumps mostly arrive from bots, so pair it with a `schedule` trigger that runs once a week with the prompt "install the requirements fresh, start each script's browser setup against a local page, and open a pull request only when something fails". Each run is its own session with its own `max_runs_per_hour` cap on the automation, and its result is read from the session like any other.

## Why run it on Rush?

A Selenium port is cheap to write and awkward to check, because checking it means a browser, a driver that matches it, and a display. A Rush sandbox has a computer of its own: the agent installs the package, lets Selenium Manager fetch a driver, runs Chrome headless and keeps the output, and none of it lands on a laptop or a shared CI runner that also has to build the streaming image.

The result carries its evidence. The transcript shows the `curl` that proved the driver bucket is empty for current Chrome, the constructor failing on the installed release, and the locator test passing on the local page, so the reviewer's remaining job is the one real-meeting check. A fleet of streaming containers forked from the same project gets the same request, one run per repository, as many at once as the key's `max_concurrent` limit allows.

## Frequently asked questions

### Why does stream.py work while chat.py fails?

Because `stream.py` was already ported: line 152 uses `Service('./chromedriver')` and `options=`, and line 176 uses `find_element(By.ID, ...)`. `chat.py` kept the Selenium 3 calls on lines 67, 90, 91, 106 and 107, and it only runs when `BBB_ENABLE_CHAT=true`, so the break shows up for the deployments that use chat.

### Can I pin selenium instead of porting?

`selenium<4.10` keeps `executable_path` with a deprecation warning, but `find_element_by_id` was removed in 4.3.0, so keeping `chat.py` unchanged means `selenium<4.3`. The port is four lines in the same style the other script already uses, and the pull request includes it rather than the pin.

### Do I still need to download chromedriver in the Dockerfile?

Not with Selenium 4.52: Selenium Manager, shipped inside the package, finds or fetches a driver for the installed Chrome when `Service()` has no path. The old download URL answers `NoSuchKey` for every Chrome release after 114, which the agent checks with `curl` and quotes in the pull request.

### Does the agent need a BigBlueButton server?

No, and it is told not to look for one. It tests the browser code against a local HTML page with the same element ids and labels the script looks for. Joining a meeting and sending a chat line are listed in the pull request as what a reviewer verifies with a test meeting.

### Will it build the Docker image?

No. The sandbox has no Docker, and the request leaves the image build to CI. The agent reproduces the Dockerfile's `pip install` step in a virtual environment, which is where the Selenium errors come from, and changes only the driver step in the Dockerfile.

## More Selenium jobs

- [Upgrade Python Selenium Tests to Selenium 4 (find_element_by_* and PhantomJS Removed)](https://getrush.ai/run/upgrade-selenium/selenium/)

## More jobs like this: Fix a bug from an alert

- [Fix "BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default"](https://getrush.ai/run/fix-webpack-5-node-polyfill-errors/webpack/)
- [Fix "Error: Cannot find module 'webpack-cli/bin/config-yargs'" When Starting webpack-dev-server](https://getrush.ai/run/fix-webpack-cli-config-yargs-not-found/webpack-dev-server/)
- [Fix "cannot load such file -- webrick (LoadError)" on Ruby 3](https://getrush.ai/run/fix-webrick-load-error/webrick/)
- [Fix "ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security'"](https://getrush.ai/run/fix-werkzeug-safe-str-cmp-import-error/werkzeug/)
- [Fix "ImportError: cannot import name 'url_quote' from 'werkzeug.urls'"](https://getrush.ai/run/fix-werkzeug-url-quote-import-error/werkzeug/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
