File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
lib/selenium/webdriver/bidi
sig/lib/selenium/webdriver/bidi
spec/integration/selenium/webdriver/bidi Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,10 @@ def provide_response(**args)
124124 )
125125 end
126126
127+ def set_cache_behavior ( behavior , *contexts )
128+ @bidi . send_cmd ( 'network.setCacheBehavior' , cacheBehavior : behavior , contexts : contexts )
129+ end
130+
127131 def on ( event , &)
128132 event = EVENTS [ event ] if event . is_a? ( Symbol )
129133 @bidi . add_callback ( event , &)
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ module Selenium
2828
2929 def provide_response : -> Hash[nil , nil ]
3030
31+ def set_cache_behavior : (String behavior, Array[BrowsingContext]) -> Hash[nil , nil ]
32+
3133 def on : (Symbol event) { (?) -> untyped } -> Hash[nil , nil ]
3234 end
3335 end
Original file line number Diff line number Diff line change @@ -176,6 +176,23 @@ class BiDi
176176 expect ( source ) . to include ( 'Hello World!' )
177177 end
178178 end
179+
180+ it 'sets the cache to bypass' do
181+ reset_driver! ( web_socket_url : true ) do |driver |
182+ browsing_context = BrowsingContext . new ( driver ) . create
183+ network = described_class . new ( driver . bidi )
184+ network . set_cache_behavior ( 'bypass' , browsing_context )
185+ expect ( network . set_cache_behavior ( 'bypass' , browsing_context ) ) . to be_a ( Hash )
186+ end
187+ end
188+
189+ it 'sets the cache to default' do
190+ reset_driver! ( web_socket_url : true ) do |driver |
191+ browsing_context = BrowsingContext . new ( driver ) . create
192+ network = described_class . new ( driver . bidi )
193+ expect ( network . set_cache_behavior ( 'default' , browsing_context ) ) . to be_a ( Hash )
194+ end
195+ end
179196 end
180197 end
181198 end
You can’t perform that action at this time.
0 commit comments