Skip to content

Commit

Permalink
[py] remove desired capabilities argument for Webkitgtk (#14128)
Browse files Browse the repository at this point in the history
* initial changes for capabilities removing

remove capabilities and add default Options

same  in safari.webdriver

* make webkitgtk.webdriver same as wpewebkit.webdriver

* fix formatting with isort

* applying formatting with tox
  • Loading branch information
iampopovich committed Jun 20, 2024
1 parent 078ff3b commit 8b56711
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
29 changes: 5 additions & 24 deletions py/selenium/webdriver/webkitgtk/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

from .options import Options
from .service import DEFAULT_EXECUTABLE_PATH
from .service import Service


Expand All @@ -30,42 +29,24 @@ class WebDriver(RemoteWebDriver):

def __init__(
self,
executable_path=DEFAULT_EXECUTABLE_PATH,
port=0,
options=None,
desired_capabilities=None,
service_log_path=None,
keep_alive=False,
service: Service = None,
):
"""Creates a new instance of the WebKitGTK driver.
Starts the service and then creates new instance of WebKitGTK Driver.
:Args:
- executable_path : path to the executable. If the default is used it assumes the executable is in the $PATH.
- port : port you would like the service to run, if left as 0, a free port will be found.
- options : an instance of WebKitGTKOptions
- desired_capabilities : Dictionary object with desired capabilities
- service_log_path : Path to write service stdout and stderr output.
- keep_alive : Whether to configure RemoteConnection to use HTTP keep-alive.
- service : Service object for handling the browser driver if you need to pass extra details
"""
if not options:
options = Options()
if not desired_capabilities:
desired_capabilities = options.to_capabilities()
else:
capabilities = options.to_capabilities()
if desired_capabilities:
capabilities.update(desired_capabilities)
desired_capabilities = capabilities

self.service = Service(executable_path, port=port, log_path=service_log_path)
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, desired_capabilities=desired_capabilities, keep_alive=keep_alive
)
super().__init__(command_executor=self.service.service_url, options=options)
self._is_remote = False

def quit(self):
Expand Down
3 changes: 1 addition & 2 deletions py/selenium/webdriver/wpewebkit/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ def __init__(
- options : an instance of ``WPEWebKitOptions``
- service : Service object for handling the browser driver if you need to pass extra details
"""
if not options:
options = Options()

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()
Expand Down

0 comments on commit 8b56711

Please sign in to comment.