From 26cd950dd3f673df4ec0491d650555404b9bf871 Mon Sep 17 00:00:00 2001 From: Omkar Chandgaonkar <156634029+11byte@users.noreply.github.com> Date: Thu, 14 Aug 2025 09:25:39 +0530 Subject: [PATCH] fixed WPE WebKit fail --- py/selenium/webdriver/wpewebkit/webdriver.py | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) 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: