Path: blob/trunk/py/selenium/webdriver/webkitgtk/options.py
1864 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 selenium.webdriver.common.desired_capabilities import DesiredCapabilities18from selenium.webdriver.common.options import ArgOptions192021class Options(ArgOptions):22KEY = "webkitgtk:browserOptions"2324def __init__(self) -> None:25super().__init__()26self._binary_location = ""27self._overlay_scrollbars_enabled = True2829@property30def binary_location(self) -> str:31""":Returns: The location of the browser binary otherwise an empty32string."""33return self._binary_location3435@binary_location.setter36def binary_location(self, value: str) -> None:37"""Allows you to set the browser binary to launch.3839:Args:40- value : path to the browser binary41"""42self._binary_location = value4344@property45def overlay_scrollbars_enabled(self):46""":Returns: Whether overlay scrollbars should be enabled."""47return self._overlay_scrollbars_enabled4849@overlay_scrollbars_enabled.setter50def overlay_scrollbars_enabled(self, value) -> None:51"""Allows you to enable or disable overlay scrollbars.5253:Args:54- value : True or False55"""56self._overlay_scrollbars_enabled = value5758def to_capabilities(self):59"""Creates a capabilities with all the options that have been set and60returns a dictionary with everything."""61caps = self._caps6263browser_options = {}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