diff --git a/splinter/driver/webdriver/remote.py b/splinter/driver/webdriver/remote.py index a0971a763..82015dd8f 100644 --- a/splinter/driver/webdriver/remote.py +++ b/splinter/driver/webdriver/remote.py @@ -13,6 +13,7 @@ from splinter.driver.webdriver.setup import _setup_chrome from splinter.driver.webdriver.setup import _setup_edge from splinter.driver.webdriver.setup import _setup_firefox +from splinter.driver.webdriver.setup import _setup_safari # MonkeyPatch RemoteConnection remote_connection.RemoteConnection._request = patch_request # type: ignore @@ -64,5 +65,12 @@ def __init__( options = options or Options() driver = _setup_firefox(Remote, self.config, options, **kwargs) + elif browser_name == "SAFARI": + from selenium.webdriver.safari.options import Options + + options = options or Options() + driver = _setup_safari(Remote, self.config, options, **kwargs) + else: + raise ValueError(f"Unsupporeted browser {browser_name}") super().__init__(driver, wait_time) diff --git a/splinter/driver/webdriver/setup.py b/splinter/driver/webdriver/setup.py index aa720ffa2..edda15388 100644 --- a/splinter/driver/webdriver/setup.py +++ b/splinter/driver/webdriver/setup.py @@ -93,3 +93,14 @@ def _setup_firefox(driver_class, config=None, options=None, service=None, **kwar rv.fullscreen_window() return rv + +def _setup_safari(driver_class, config=None, options=None, service=None, **kwargs): + """ + Returns: selenium.webdriver.Safari || selenium.webdriver.Remote + """ + if driver_class == Remote: + rv = driver_class(options=options, **kwargs) + else: + rv = driver_class(options=options, service=service, **kwargs) + + return rv