| 22 | |
| 23 | |
| 24 | class Options(ArgOptions): |
| 25 | KEY = "webkitgtk:browserOptions" |
| 26 | |
| 27 | def __init__(self) -> None: |
| 28 | super().__init__() |
| 29 | self._binary_location = "" |
| 30 | self._overlay_scrollbars_enabled = True |
| 31 | |
| 32 | @property |
| 33 | def binary_location(self) -> str: |
| 34 | """Return the location of the browser binary or an empty string.""" |
| 35 | return self._binary_location |
| 36 | |
| 37 | @binary_location.setter |
| 38 | def binary_location(self, value: str) -> None: |
| 39 | """Allows you to set the browser binary to launch. |
| 40 | |
| 41 | Args: |
| 42 | value: path to the browser binary |
| 43 | """ |
| 44 | self._binary_location = value |
| 45 | |
| 46 | @property |
| 47 | def overlay_scrollbars_enabled(self) -> bool: |
| 48 | """Return whether overlay scrollbars should be enabled.""" |
| 49 | return self._overlay_scrollbars_enabled |
| 50 | |
| 51 | @overlay_scrollbars_enabled.setter |
| 52 | def overlay_scrollbars_enabled(self, value) -> None: |
| 53 | """Allows you to enable or disable overlay scrollbars. |
| 54 | |
| 55 | Args: |
| 56 | value: True or False |
| 57 | """ |
| 58 | self._overlay_scrollbars_enabled = value |
| 59 | |
| 60 | def to_capabilities(self) -> dict: |
| 61 | """Create a capabilities dictionary with all set options.""" |
| 62 | caps = self._caps |
| 63 | |
| 64 | browser_options: dict[str, Any] = {} |
| 65 | if self.binary_location: |
| 66 | browser_options["binary"] = self.binary_location |
| 67 | if self.arguments: |
| 68 | browser_options["args"] = self.arguments |
| 69 | browser_options["useOverlayScrollbars"] = self.overlay_scrollbars_enabled |
| 70 | |
| 71 | caps[Options.KEY] = browser_options |
| 72 | |
| 73 | return caps |
| 74 | |
| 75 | @property |
| 76 | def default_capabilities(self): |
| 77 | return DesiredCapabilities.WEBKITGTK.copy() |