You almost certainly have a file named `selenium.py` in your working directory, and Python imports your file instead of the real package. Rename it (and delete the `__pycache__` folder next to it) and the import works. If there is no such file, your selenium install is broken and `pip install --force-reinstall selenium` fixes it.

## The error

```text
ImportError: cannot import name 'webdriver' from 'selenium'
```

## Fix it

1. **Check what Python imported as selenium**

```
python -c "import selenium; print(selenium.__file__)"
```
Expected: a site-packages path ending in `selenium/__init__.py`. If it prints a path in your project folder ending in `selenium.py`, that file is the culprit.

2. **Rename the shadowing file**

Rename your `selenium.py` to something like `selenium_demo.py` and remove any `__pycache__` directory beside it. Then:
```
python -c "from selenium import webdriver; print('ok')"
```
Expected: prints `ok`. Python searches the script's directory before site-packages, so your file always won before.

3. **If there is no shadowing file, reinstall**

```
python -m pip install --force-reinstall selenium
```
Expected: the import in step 2 now works. A corrupted install can leave a selenium package directory with no webdriver subpackage inside.

## When this applies

- `from selenium import webdriver` raises ImportError naming `webdriver`
- your script lives next to a file called `selenium.py`
- the same import works in every folder except your project folder

## When it does NOT apply

- `ModuleNotFoundError: No module named 'selenium'` means nothing is installed
- `'chromedriver' executable needs to be in PATH` happens after a successful import, at driver startup
- `SessionNotCreatedException` is a browser/driver version problem

## Compatibility

All selenium 3.x and 4.x. The shadowing behavior is pure Python import semantics and applies to every version.

## Why it happens

Python's import system checks the current working directory (the script's folder) before site-packages. A tutorial-style file named `selenium.py` therefore becomes the `selenium` module, and since your file defines no `webdriver` name, the from-import fails. The same trap catches any popular package name used as a script filename.

## Edge cases

- Deleting `selenium.py` is not enough if `__pycache__/selenium.cpython-312.pyc` remains. Clear the cache dir too.
- Jupyter: a notebook named selenium.ipynb in the working dir does the same thing. Rename it and restart the kernel.
- IDEs sometimes add the project root to sys.path even when you run from elsewhere. The `selenium.__file__` check in step 1 sees through that.
