Path: blob/trunk/py/selenium/webdriver/edge/webdriver.py
3995 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.chromium.webdriver import ChromiumDriver18from selenium.webdriver.common.desired_capabilities import DesiredCapabilities19from selenium.webdriver.edge.options import Options20from selenium.webdriver.edge.service import Service212223class WebDriver(ChromiumDriver):24"""Controls the MSEdgeDriver and allows you to drive the browser."""2526def __init__(27self,28options: Options | None = None,29service: Service | None = None,30keep_alive: bool = True,31) -> None:32"""Creates a new instance of the edge driver.3334Starts the service and then creates new instance of edge driver.3536Args:37options: Instance of Options.38service: Service object for handling the browser driver if you need to pass extra details.39keep_alive: Whether to configure EdgeRemoteConnection to use HTTP keep-alive.40"""41self.service = service if service else Service()42self.options = options if options else Options()4344super().__init__(45browser_name=DesiredCapabilities.EDGE["browserName"],46vendor_prefix="ms",47options=self.options,48service=self.service,49keep_alive=keep_alive,50)515253