Path: blob/trunk/py/selenium/webdriver/webkitgtk/options.py
3985 views
# Licensed to the Software Freedom Conservancy (SFC) under one1# or more contributor license agreements. See the NOTICE file2# distributed with this work for additional information3# regarding copyright ownership. The SFC licenses this file4# to you under the Apache License, Version 2.0 (the5# "License"); you may not use this file except in compliance6# with the License. You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing,11# software distributed under the License is distributed on an12# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13# KIND, either express or implied. See the License for the14# specific language governing permissions and limitations15# under the License.1617from typing import Any1819from selenium.webdriver.common.desired_capabilities import DesiredCapabilities20from selenium.webdriver.common.options import ArgOptions212223class Options(ArgOptions):24KEY = "webkitgtk:browserOptions"2526def __init__(self) -> None:27super().__init__()28self._binary_location = ""29self._overlay_scrollbars_enabled = True3031@property32def binary_location(self) -> str:33"""Return the location of the browser binary or an empty string."""34return self._binary_location3536@binary_location.setter37def binary_location(self, value: str) -> None:38"""Allows you to set the browser binary to launch.3940Args:41value: path to the browser binary42"""43self._binary_location = value4445@property46def overlay_scrollbars_enabled(self) -> bool:47"""Return whether overlay scrollbars should be enabled."""48return self._overlay_scrollbars_enabled4950@overlay_scrollbars_enabled.setter51def overlay_scrollbars_enabled(self, value) -> None:52"""Allows you to enable or disable overlay scrollbars.5354Args:55value: True or False56"""57self._overlay_scrollbars_enabled = value5859def to_capabilities(self) -> dict:60"""Create a capabilities dictionary with all set options."""61caps = self._caps6263browser_options: dict[str, Any] = {}64if self.binary_location:65browser_options["binary"] = self.binary_location66if self.arguments:67browser_options["args"] = self.arguments68browser_options["useOverlayScrollbars"] = self.overlay_scrollbars_enabled6970caps[Options.KEY] = browser_options7172return caps7374@property75def default_capabilities(self):76return DesiredCapabilities.WEBKITGTK.copy()777879