Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions py/selenium/webdriver/wpewebkit/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down