Path: blob/trunk/py/selenium/webdriver/webkitgtk/webdriver.py
4005 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.driver_finder import DriverFinder18from selenium.webdriver.common.webdriver import LocalWebDriver19from selenium.webdriver.webkitgtk.options import Options20from selenium.webdriver.webkitgtk.service import Service212223class WebDriver(LocalWebDriver):24"""Controls the WebKitGTKDriver and allows you to drive the browser."""2526def __init__(27self,28options: Options | None = None,29service: Service | None = None,30):31"""Creates a new instance of the WebKitGTK driver.3233Starts the service and then creates new instance of WebKitGTK Driver.3435Args:36options: Instance of Options.37service: Service object for handling the browser driver if you need to pass extra details.38"""39self.options = options if options else Options()40self.service = service if service else Service()41self.service.path = DriverFinder(self.service, self.options).get_driver_path()42self.service.start()4344try:45super().__init__(command_executor=self.service.service_url, options=self.options)46except Exception:47self.quit()48raise495051