Path: blob/trunk/py/selenium/webdriver/ie/webdriver.py
3989 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.ie.options import Options20from selenium.webdriver.ie.service import Service21from selenium.webdriver.remote.client_config import ClientConfig22from selenium.webdriver.remote.remote_connection import RemoteConnection232425class WebDriver(LocalWebDriver):26"""Control the IEServerDriver and drive Internet Explorer."""2728def __init__(29self,30options: Options | None = None,31service: Service | None = None,32keep_alive: bool = True,33) -> None:34"""Creates a new instance of the Ie driver.3536Starts the service and then creates new instance of Ie driver.3738Args:39options: Instance of Options.40service: Service object for handling the browser driver if you need to pass extra details.41keep_alive: Whether to configure RemoteConnection to use HTTP keep-alive.42"""43self.service = service if service else Service()44self.options = options if options else Options()4546self.service.path = self.service.env_path() or DriverFinder(self.service, self.options).get_driver_path()47self.service.start()4849client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)50executor = RemoteConnection(51ignore_proxy=self.options._ignore_local_proxy,52client_config=client_config,53)5455try:56super().__init__(command_executor=executor, options=self.options)57except Exception:58self.quit()59raise606162