Path: blob/trunk/py/selenium/webdriver/wpewebkit/options.py
4020 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"""Return the location of the browser binary or an empty string."""32return self._binary_location3334@binary_location.setter35def binary_location(self, value: str) -> None:36"""Allows you to set the browser binary to launch.3738Args:39value: path to the browser binary40"""41if not isinstance(value, str):42raise TypeError(self.BINARY_LOCATION_ERROR)43self._binary_location = value4445def to_capabilities(self) -> dict:46"""Create a capabilities dictionary with all set options."""47caps = self._caps4849browser_options = {}50if self.binary_location:51browser_options["binary"] = self.binary_location52if self.arguments:53browser_options["args"] = self.arguments5455caps[Options.KEY] = browser_options5657return caps5859@property60def default_capabilities(self) -> dict[str, str]:61return DesiredCapabilities.WPEWEBKIT.copy()626364