# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819require 'tmpdir'20require 'fileutils'21require 'date'22require 'json'23require 'uri'24require 'net/http'2526require 'selenium/webdriver/atoms'27require 'selenium/webdriver/common'28require 'selenium/webdriver/version'2930module Selenium31module WebDriver32Point = Struct.new(:x, :y)33Dimension = Struct.new(:width, :height)34Rectangle = Struct.new(:x, :y, :width, :height)3536autoload :BiDi, 'selenium/webdriver/bidi'37autoload :Chromium, 'selenium/webdriver/chromium'38autoload :Chrome, 'selenium/webdriver/chrome'39autoload :DevTools, 'selenium/webdriver/devtools'40autoload :Edge, 'selenium/webdriver/edge'41autoload :Firefox, 'selenium/webdriver/firefox'42autoload :IE, 'selenium/webdriver/ie'43autoload :Remote, 'selenium/webdriver/remote'44autoload :Safari, 'selenium/webdriver/safari'45autoload :Support, 'selenium/webdriver/support'4647# @api private4849def self.root50@root ||= File.expand_path('..', __dir__.to_s)51end5253#54# Create a new Driver instance with the correct bridge for the given browser55#56# @overload for(browser)57# @param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari] browser The browser to58# create the driver for59# @overload for(browser, opts)60# @param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari] browser The browser to61# create the driver for62# @param [Hash] opts Options passed to Driver.new63#64# @return [Driver]65#66# @see Selenium::WebDriver::Remote::Driver67# @see Selenium::WebDriver::Firefox::Driver68# @see Selenium::WebDriver::IE::Driver69# @see Selenium::WebDriver::Edge::Driver70# @see Selenium::WebDriver::Chrome::Driver71# @see Selenium::WebDriver::Safari::Driver72#73# @example74#75# WebDriver.for :firefox, profile: 'some-profile'76# WebDriver.for :firefox, profile: Profile.new77# WebDriver.for :remote, url: "http://localhost:4444/wd/hub", capabilities: caps78#79# One special argument is not passed on to the bridges, :listener.80# You can pass a listener for this option to get notified of WebDriver events.81# The passed object must respond to #call or implement the methods from AbstractEventListener.82#83# @see Selenium::WebDriver::Support::AbstractEventListener84#8586def self.for(*)87WebDriver::Driver.for(*)88end8990#91# Returns logger instance that can be used across the whole Selenium.92#93# @return [Logger]94#9596def self.logger(**)97level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info98@logger ||= WebDriver::Logger.new('Selenium', default_level: level, **)99end100end # WebDriver101end # Selenium102103104