File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,32 @@ class BrowsingContext {
268
268
throw Error ( result [ 'error' ] )
269
269
}
270
270
}
271
+
272
+ async reload ( ignoreCache = undefined , readinessState = undefined ) {
273
+ if (
274
+ readinessState !== undefined &&
275
+ ! [ 'none' , 'interactive' , 'complete' ] . includes ( readinessState )
276
+ ) {
277
+ throw Error (
278
+ `Valid readiness states are 'none', 'interactive' & 'complete'. Received: ${ readinessState } `
279
+ )
280
+ }
281
+
282
+ const params = {
283
+ method : 'browsingContext.reload' ,
284
+ params : {
285
+ context : this . _id ,
286
+ ignoreCache : ignoreCache ,
287
+ wait : readinessState ,
288
+ } ,
289
+ }
290
+ const navigateResult = ( await this . bidi . send ( params ) ) [ 'result' ]
291
+
292
+ return new NavigateResult (
293
+ navigateResult [ 'url' ] ,
294
+ navigateResult [ 'navigation' ]
295
+ )
296
+ }
271
297
}
272
298
273
299
class NavigateResult {
Original file line number Diff line number Diff line change @@ -645,6 +645,38 @@ suite(
645
645
const result = await driver . getPageSource ( )
646
646
assert . equal ( result . includes ( userText ) , false )
647
647
} )
648
+
649
+ it . skip ( 'can reload a browsing context' , async function ( ) {
650
+ const id = await driver . getWindowHandle ( )
651
+ const browsingContext = await BrowsingContext ( driver , {
652
+ browsingContextId : id ,
653
+ } )
654
+
655
+ const result = await browsingContext . navigate (
656
+ Pages . logEntryAdded ,
657
+ 'complete'
658
+ )
659
+
660
+ await browsingContext . reload ( )
661
+ assert . equal ( result . navigationId , null )
662
+ assert ( result . url . includes ( '/bidi/logEntryAdded.html' ) )
663
+ } )
664
+
665
+ it . skip ( 'can reload with readiness state' , async function ( ) {
666
+ const id = await driver . getWindowHandle ( )
667
+ const browsingContext = await BrowsingContext ( driver , {
668
+ browsingContextId : id ,
669
+ } )
670
+
671
+ const result = await browsingContext . navigate (
672
+ Pages . logEntryAdded ,
673
+ 'complete'
674
+ )
675
+
676
+ await browsingContext . reload ( undefined , 'complete' )
677
+ assert . notEqual ( result . navigationId , null )
678
+ assert ( result . url . includes ( '/bidi/logEntryAdded.html' ) )
679
+ } )
648
680
} )
649
681
650
682
describe ( 'Browsing Context Inspector' , function ( ) {
You can’t perform that action at this time.
0 commit comments