diff --git a/py/selenium/webdriver/wpewebkit/webdriver.py b/py/selenium/webdriver/wpewebkit/webdriver.py index 64e298cc475c5..3aa73da5b69d1 100644 --- a/py/selenium/webdriver/wpewebkit/webdriver.py +++ b/py/selenium/webdriver/wpewebkit/webdriver.py @@ -20,6 +20,7 @@ from selenium.webdriver.common.driver_finder import DriverFinder from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver +from selenium.webdriver.remote.remote_connection import RemoteConnection from .options import Options from .service import Service @@ -30,29 +31,32 @@ class WebDriver(RemoteWebDriver): def __init__( self, - options=None, + options: Optional[Options] = None, service: Optional[Service] = None, ): - """Creates a new instance of the WPEWebKit driver. - - Starts the service and then creates new instance of WPEWebKit Driver. - - :Args: - - options : an instance of ``WPEWebKitOptions`` - - service : Service object for handling the browser driver if you need to pass extra details """ + Creates a new instance of the WPEWebKit driver. + :param options: an instance of ``WPEWebKitOptions`` + :param service: Service object for handling the browser driver if you need to pass extra details + """ options = options if options else Options() self.service = service if service else Service() self.service.path = DriverFinder(self.service, options).get_driver_path() self.service.start() - super().__init__(command_executor=self.service.service_url, options=options) + # Use minimal capabilities to avoid "Invalid alwaysMatch capabilities" + capabilities = { + "browserName": "wpewebkit" # or "MiniBrowser" if that works better + } + + executor = RemoteConnection(self.service.service_url, resolve_ip=False) + + super().__init__(command_executor=executor, desired_capabilities=capabilities) self._is_remote = False def quit(self): - """Closes the browser and shuts down the WPEWebKitDriver executable - that is started when starting the WPEWebKitDriver.""" + """Closes the browser and shuts down the WPEWebKitDriver executable.""" try: super().quit() except http_client.BadStatusLine: