Debian Codegraph @

selenium/webdriver/webkitgtk/options.py

raw symbols SCIP
1 # Licensed to the Software Freedom Conservancy (SFC) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The SFC licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17
18 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
19 from selenium.webdriver.common.options import ArgOptions
20
21
22 class Options(ArgOptions):
23 KEY = "webkitgtk:browserOptions"
24
25 def __init__(self) -> None:
26 super().__init__()
27 self._binary_location = ""
28 self._overlay_scrollbars_enabled = True
29
30 @property
31 def binary_location(self) -> str:
32 """:Returns: The location of the browser binary otherwise an empty
33 string."""
34 return self._binary_location
35
36 @binary_location.setter
37 def binary_location(self, value: str) -> None:
38 """Allows you to set the browser binary to launch.
39
40 :Args:
41 - value : path to the browser binary
42 """
43 self._binary_location = value
44
45 @property
46 def overlay_scrollbars_enabled(self):
47 """:Returns: Whether overlay scrollbars should be enabled."""
48 return self._overlay_scrollbars_enabled
49
50 @overlay_scrollbars_enabled.setter
51 def overlay_scrollbars_enabled(self, value) -> None:
52 """Allows you to enable or disable overlay scrollbars.
53
54 :Args:
55 - value : True or False
56 """
57 self._overlay_scrollbars_enabled = value
58
59 def to_capabilities(self):
60 """Creates a capabilities with all the options that have been set and
61 returns a dictionary with everything."""
62 caps = self._caps
63
64 browser_options = {}
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()