Path: blob/trunk/py/selenium/webdriver/wpewebkit/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.161718from selenium.webdriver.common.desired_capabilities import DesiredCapabilities19from selenium.webdriver.common.options import ArgOptions202122class Options(ArgOptions):23KEY = "wpe:browserOptions"2425def __init__(self) -> None:26super().__init__()27self._binary_location = ""2829@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"""42if not isinstance(value, str):43raise TypeError(self.BINARY_LOCATION_ERROR)44self._binary_location = value4546def to_capabilities(self):47"""Creates a capabilities with all the options that have been set and48returns a dictionary with everything."""49caps = self._caps5051browser_options = {}52if self.binary_location:53browser_options["binary"] = self.binary_location54if self.arguments:55browser_options["args"] = self.arguments5657caps[Options.KEY] = browser_options5859return caps6061@property62def default_capabilities(self) -> dict[str, str]:63return DesiredCapabilities.WPEWEBKIT.copy()646566