{"record":{"id":"20fba1d549afc4a3","repo":"SeleniumHQ/selenium","slug":"module-name-r-has-no-attribute-name-r-20fba1","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/wpewebkit/__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/wpewebkit/__init__.py#L10-L33","documentation":"Raised by the module-level __getattr__ in selenium.webdriver.wpewebkit.__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 identical to the webkitgtk package: submodules are imported on first access, any other name raises AttributeError.","triggerScenarios":"Accessing an attribute on the wpewebkit package that does not exist: e.g., wpewebkit.options with a typo, or wpewebkit.SomeClass at the package root. Also triggered by incorrect capitalization or trying to reach an internal module that was never part of _LAZY_SUBMODULES.","commonSituations":"Typo in submodule or class name; importing a class from the package root instead of the submodule; code completion suggesting a wrong attribute; confusion between package-level and submodule-level access patterns.","solutions":["Use the correct submodule names: wpewebkit.options, wpewebkit.service, wpewebkit.webdriver.","Import from the submodule: from selenium.webdriver.wpewebkit.options import Options.","Check dir(wpewebkit) to see available submodules.","Verify spelling and case."],"exampleFix":"// before\nfrom selenium.webdriver import wpewebkit\nsvc = wpewebkit.service  # might work, but:\nbad = wpewebkit.services  # typo -> AttributeError\n// after\nfrom selenium.webdriver.wpewebkit.service import Service\nsvc = Service()","handlingStrategy":"validation","validationCode":"from selenium.webdriver import wpewebkit\n\nAVAILABLE = dir(wpewebkit)  # ['options', 'service', 'webdriver']\nif 'webdriver' in AVAILABLE:\n    from selenium.webdriver.wpewebkit.webdriver import WebDriver","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Import from the submodule directly: from selenium.webdriver.wpewebkit.options import Options.","Use dir(wpewebkit) to discover available submodules.","The three submodules are lowercase: options, service, webdriver."],"tags":["selenium","wpewebkit","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"}