Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/rb/lib/selenium/webdriver/chromium/driver.rb
1856 views
1
# frozen_string_literal: true
2
3
# Licensed to the Software Freedom Conservancy (SFC) under one
4
# or more contributor license agreements. See the NOTICE file
5
# distributed with this work for additional information
6
# regarding copyright ownership. The SFC licenses this file
7
# to you under the Apache License, Version 2.0 (the
8
# "License"); you may not use this file except in compliance
9
# with the License. You may obtain a copy of the License at
10
#
11
# http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing,
14
# software distributed under the License is distributed on an
15
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
# KIND, either express or implied. See the License for the
17
# specific language governing permissions and limitations
18
# under the License.
19
20
module Selenium
21
module WebDriver
22
module Chromium
23
#
24
# Driver implementation for Chrome.
25
# @api private
26
#
27
28
class Driver < WebDriver::Driver
29
EXTENSIONS = [DriverExtensions::HasCDP,
30
DriverExtensions::HasBiDi,
31
DriverExtensions::HasCasting,
32
DriverExtensions::HasFedCmDialog,
33
DriverExtensions::HasNetworkConditions,
34
DriverExtensions::HasNetworkInterception,
35
DriverExtensions::HasLaunching,
36
DriverExtensions::HasPermissions,
37
DriverExtensions::DownloadsFiles,
38
DriverExtensions::HasDevTools,
39
DriverExtensions::HasAuthentication,
40
DriverExtensions::HasLogs,
41
DriverExtensions::HasLogEvents,
42
DriverExtensions::HasPinnedScripts,
43
DriverExtensions::PrintsPage].freeze
44
45
protected
46
47
def devtools_url
48
uri = URI(devtools_address)
49
response = Net::HTTP.get(uri.hostname, '/json/version', uri.port)
50
51
JSON.parse(response)['webSocketDebuggerUrl']
52
end
53
54
def devtools_version
55
Integer(capabilities.browser_version.split('.').first)
56
end
57
end # Driver
58
end # Chromium
59
end # WebDriver
60
end # Selenium
61
62