SeleniumHQ/selenium · warning · AttributeError
module {__name__!r} has no attribute {name!r}
Error message
module {__name__!r} has no attribute {name!r} What it means
Raised by the module-level __getattr__ in selenium.webdriver.edge when an attribute access does not match one of the lazily-imported submodules (options, remote_connection, service, webdriver). The package uses PEP 562 lazy imports to reduce startup cost, so only those four names auto-resolve; anything else raises a clear AttributeError naming the missing attribute.
Source
Thrown at py/selenium/webdriver/edge/__init__.py:28
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import importlib
_LAZY_SUBMODULES = ["options", "remote_connection", "service", "webdriver"]
def __getattr__(name):
if name in _LAZY_SUBMODULES:
module = importlib.import_module(f".{name}", __name__)
globals()[name] = module
return module
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
def __dir__():
return sorted(_LAZY_SUBMODULES)
View on GitHub (pinned to aa36b38e69)
Solutions
- Check the spelling against _LAZY_SUBMODULES: options, remote_connection, service, webdriver.
- Access classes through their submodule: from selenium.webdriver.edge.options import Options.
Example fix
# before from selenium.webdriver.edge import Options # -> AttributeError # after from selenium.webdriver.edge.options import Options
Defensive patterns
Strategy: validation
Validate before calling
from selenium.webdriver import edge
_VALID = {'options','remote_connection','service','webdriver','firefox_profile'}
assert name in _VALID, f'{name!r} is not an edge submodule; use edge.<submodule>.<Class>' Type guard
null
Try / catch
null
Prevention
- Import classes from their submodule: edge.options.Options.
- Rely on IDE go-to-definition rather than guessing top-level names.
- Keep a cheat-sheet of the five lazy submodules.
When it happens
Trigger: Accessing selenium.webdriver.edge.SomeName where SomeName is not in _LAZY_SUBMODULES — e.g. a typo like 'option' instead of 'options', or trying to access a class that lives in a submodule without the submodule prefix (e.g. selenium.webdriver.edge.Options instead of selenium.webdriver.edge.options.Options).
Common situations: Typing the submodule name wrong, expecting a top-level re-export that does not exist, or IDE auto-complete suggesting a non-existent attribute. Also from 'from selenium.webdriver.edge import X' where X is not a known submodule.
Related errors
- module {__name__!r} has no attribute {name!r}
- service_args must be a sequence
- Can't get debugger address.
- Linux arm64 is not supported yet by Microsoft Edge. Please t
- Linux arm64 is not supported yet by {}. Please try another b
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/79d548e5f31e2002.
Report an issue: GitHub.