{"record":{"id":"ccb069ffc6568afe","repo":"SeleniumHQ/selenium","slug":"module-name-r-has-no-attribute-name-r-ccb069","errorCode":null,"errorMessage":"module {__name__!r} has no attribute {name!r}","messagePattern":"module (.+?) has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/webkitgtk/__init__.py","lineNumber":28,"sourceCode":"#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nimport importlib\n\n_LAZY_SUBMODULES = [\"options\", \"service\", \"webdriver\"]\n\n\ndef __getattr__(name):\n    if name in _LAZY_SUBMODULES:\n        module = importlib.import_module(f\".{name}\", __name__)\n        globals()[name] = module\n        return module\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\ndef __dir__():\n    return sorted(_LAZY_SUBMODULES)\n","sourceCodeStart":10,"sourceCodeEnd":33,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/webkitgtk/__init__.py#L10-L33","documentation":"Raised by the module-level __getattr__ in selenium.webdriver.webkitgtk.__init__ when an attribute name is accessed that is not one of the lazily-loadable submodules ('options', 'service', 'webdriver'). This is a PEP 562 lazy import pattern: the three submodules are imported on first access and cached in globals(), while any other name raises a standard AttributeError. This mirrors Python's built-in behavior for missing module attributes.","triggerScenarios":"Accessing an attribute on the webkitgtk package that does not exist: e.g., from selenium.webdriver import webkitgtk; webkitgtk.WebDriver (capital W, wrong case) or webkitgtk.some_helper (nonexistent). Also triggered by typo in submodule name or accessing an internal helper that was never exported.","commonSituations":"Typo in the submodule or class name (e.g., Options with capital O vs options lowercase); trying to import a class directly from the package root when it lives in a submodule; code completion suggesting a wrong name; migrating from an older API where the attribute existed but was since removed or renamed.","solutions":["Use the correct submodule names: webkitgtk.options, webkitgtk.service, webkitgtk.webdriver.","Import classes from their submodule: from selenium.webdriver.webkitgtk.options import Options.","Check dir(webkitgtk) to see the available submodules (the __dir__ implementation returns sorted(_LAZY_SUBMODULES)).","Verify spelling and case — submodule names are lowercase, class names are CamelCase."],"exampleFix":"// before\nfrom selenium.webdriver import webkitgtk\ndriver_class = webkitgtk.WebDriver  # AttributeError\n// after\nfrom selenium.webdriver.webkitgtk.webdriver import WebDriver\ndriver_class = WebDriver","handlingStrategy":"validation","validationCode":"from selenium.webdriver import webkitgtk\n\nAVAILABLE = dir(webkitgtk)  # ['options', 'service', 'webdriver']\nif 'webdriver' in AVAILABLE:\n    from selenium.webdriver.webkitgtk.webdriver import WebDriver","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Import from the submodule directly: from selenium.webdriver.webkitgtk.options import Options.","Use dir(webkitgtk) to discover available submodules.","Remember the three submodules are lowercase: options, service, webdriver."],"tags":["selenium","webkitgtk","import","lazy-loading","python","attribute-error"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}