File tree Expand file tree Collapse file tree
spec/integration/selenium/webdriver/chrome Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ module Chrome
2727 #
2828
2929 class Driver < WebDriver ::Driver
30- EXTENSIONS = [ DriverExtensions ::HasNetworkConditions ,
30+ EXTENSIONS = [ DriverExtensions ::HasCDP ,
31+ DriverExtensions ::HasNetworkConditions ,
3132 DriverExtensions ::HasNetworkInterception ,
3233 DriverExtensions ::HasWebStorage ,
3334 DriverExtensions ::HasLocation ,
@@ -42,10 +43,6 @@ def browser
4243 :chrome
4344 end
4445
45- def execute_cdp ( cmd , **params )
46- @bridge . send_command ( cmd : cmd , params : params )
47- end
48-
4946 private
5047
5148 def devtools_url
Original file line number Diff line number Diff line change 6767require 'selenium/webdriver/common/driver_extensions/has_authentication'
6868require 'selenium/webdriver/common/driver_extensions/has_logs'
6969require 'selenium/webdriver/common/driver_extensions/has_log_events'
70+ require 'selenium/webdriver/common/driver_extensions/has_cdp'
7071require 'selenium/webdriver/common/keys'
7172require 'selenium/webdriver/common/profile_helper'
7273require 'selenium/webdriver/common/options'
Original file line number Diff line number Diff line change 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 DriverExtensions
23+ module HasCDP
24+
25+ #
26+ # Returns network conditions.
27+ #
28+ # @return [Hash]
29+ #
30+
31+ def execute_cdp ( cmd , **params )
32+ @bridge . send_command ( cmd : cmd , params : params )
33+ end
34+
35+ end # HasCDP
36+ end # DriverExtensions
37+ end # WebDriver
38+ end # Selenium
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ module Chrome
3939 # at least it doesn't crash
4040 end
4141
42- it 'can execute CDP commands' , only : { driver : :chrome } do
42+ it 'can execute CDP commands' do
4343 res = driver . execute_cdp ( 'Page.addScriptToEvaluateOnNewDocument' , source : 'window.was_here="TW";' )
4444 expect ( res ) . to have_key ( 'identifier' )
4545
You can’t perform that action at this time.
0 commit comments