'No module named 'selenium.webdriver.safari.options'

Requirements
OS macOS Monterey 12.3.1
Selenium version 4.1.1
Python 3.10
Safari 15.4 (17613.1.17.1.13)
from selenium.webdriver.safari.options import Options as SafariOptions
self.options = SafariOptions()

ModuleNotFoundError: No module named 'selenium.webdriver.safari.options'

and I can't use desired_capabilities in selenium4 because:

        if desired_capabilities:
        warnings.warn(
            "desired_capabilities has been deprecated, please pass in an Options object with options kwarg",
            DeprecationWarning,
            stacklevel=2
        )


Solution 1:[1]

Safari Options was a known bug for Selenium 4 for Py.

This has been resolved - Py safari options #10385

This was merged into release 4.1.3 for Py, update your Selenium version to 4.1.3 or 4.1.4 to resolve the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 djmonki