2020using OpenQA . Selenium . BiDi . Json . Converters ;
2121using System . Text . Json ;
2222using System . Text . Json . Serialization ;
23+ using System . Threading ;
2324using System . Threading . Tasks ;
2425
2526namespace OpenQA . Selenium . BiDi . Browser ;
@@ -28,55 +29,54 @@ public sealed class BrowserModule : Module
2829{
2930 private BrowserJsonSerializerContext _jsonContext = null ! ;
3031
31- public async Task < CloseResult > CloseAsync ( CloseOptions ? options = null )
32+ public async Task < CloseResult > CloseAsync ( CloseOptions ? options = null , CancellationToken cancellationToken = default )
3233 {
33- return await ExecuteCommandAsync ( new CloseCommand ( ) , options , _jsonContext . CloseCommand , _jsonContext . CloseResult ) . ConfigureAwait ( false ) ;
34+ return await ExecuteCommandAsync ( new CloseCommand ( ) , options , _jsonContext . CloseCommand , _jsonContext . CloseResult , cancellationToken ) . ConfigureAwait ( false ) ;
3435 }
3536
36- public async Task < CreateUserContextResult > CreateUserContextAsync ( CreateUserContextOptions ? options = null )
37+ public async Task < CreateUserContextResult > CreateUserContextAsync ( CreateUserContextOptions ? options = null , CancellationToken cancellationToken = default )
3738 {
3839 var @params = new CreateUserContextParameters ( options ? . AcceptInsecureCerts , options ? . Proxy , options ? . UnhandledPromptBehavior ) ;
3940
40- return await ExecuteCommandAsync ( new CreateUserContextCommand ( @params ) , options , _jsonContext . CreateUserContextCommand , _jsonContext . CreateUserContextResult ) . ConfigureAwait ( false ) ;
41+ return await ExecuteCommandAsync ( new CreateUserContextCommand ( @params ) , options , _jsonContext . CreateUserContextCommand , _jsonContext . CreateUserContextResult , cancellationToken ) . ConfigureAwait ( false ) ;
4142 }
4243
43- public async Task < GetUserContextsResult > GetUserContextsAsync ( GetUserContextsOptions ? options = null )
44+ public async Task < GetUserContextsResult > GetUserContextsAsync ( GetUserContextsOptions ? options = null , CancellationToken cancellationToken = default )
4445 {
45- return await ExecuteCommandAsync ( new GetUserContextsCommand ( ) , options , _jsonContext . GetUserContextsCommand , _jsonContext . GetUserContextsResult ) . ConfigureAwait ( false ) ;
46+ return await ExecuteCommandAsync ( new GetUserContextsCommand ( ) , options , _jsonContext . GetUserContextsCommand , _jsonContext . GetUserContextsResult , cancellationToken ) . ConfigureAwait ( false ) ;
4647 }
4748
48- public async Task < RemoveUserContextResult > RemoveUserContextAsync ( UserContext userContext , RemoveUserContextOptions ? options = null )
49+ public async Task < RemoveUserContextResult > RemoveUserContextAsync ( UserContext userContext , RemoveUserContextOptions ? options = null , CancellationToken cancellationToken = default )
4950 {
5051 var @params = new RemoveUserContextParameters ( userContext ) ;
5152
52- return await ExecuteCommandAsync ( new RemoveUserContextCommand ( @params ) , options , _jsonContext . RemoveUserContextCommand , _jsonContext . RemoveUserContextResult ) . ConfigureAwait ( false ) ;
53+ return await ExecuteCommandAsync ( new RemoveUserContextCommand ( @params ) , options , _jsonContext . RemoveUserContextCommand , _jsonContext . RemoveUserContextResult , cancellationToken ) . ConfigureAwait ( false ) ;
5354 }
5455
55- public async Task < GetClientWindowsResult > GetClientWindowsAsync ( GetClientWindowsOptions ? options = null )
56+ public async Task < GetClientWindowsResult > GetClientWindowsAsync ( GetClientWindowsOptions ? options = null , CancellationToken cancellationToken = default )
5657 {
57- return await ExecuteCommandAsync ( new ( ) , options , _jsonContext . GetClientWindowsCommand , _jsonContext . GetClientWindowsResult
58- ) . ConfigureAwait ( false ) ;
58+ return await ExecuteCommandAsync ( new ( ) , options , _jsonContext . GetClientWindowsCommand , _jsonContext . GetClientWindowsResult , cancellationToken ) . ConfigureAwait ( false ) ;
5959 }
6060
61- public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorAllowedAsync ( string destinationFolder , SetDownloadBehaviorOptions ? options = null )
61+ public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorAllowedAsync ( string destinationFolder , SetDownloadBehaviorOptions ? options = null , CancellationToken cancellationToken = default )
6262 {
6363 var @params = new SetDownloadBehaviorParameters ( new DownloadBehaviorAllowed ( destinationFolder ) , options ? . UserContexts ) ;
6464
65- return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult ) . ConfigureAwait ( false ) ;
65+ return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult , cancellationToken ) . ConfigureAwait ( false ) ;
6666 }
6767
68- public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorAllowedAsync ( SetDownloadBehaviorOptions ? options = null )
68+ public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorAllowedAsync ( SetDownloadBehaviorOptions ? options = null , CancellationToken cancellationToken = default )
6969 {
7070 var @params = new SetDownloadBehaviorParameters ( null , options ? . UserContexts ) ;
7171
72- return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult ) . ConfigureAwait ( false ) ;
72+ return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult , cancellationToken ) . ConfigureAwait ( false ) ;
7373 }
7474
75- public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorDeniedAsync ( SetDownloadBehaviorOptions ? options = null )
75+ public async Task < SetDownloadBehaviorResult > SetDownloadBehaviorDeniedAsync ( SetDownloadBehaviorOptions ? options = null , CancellationToken cancellationToken = default )
7676 {
7777 var @params = new SetDownloadBehaviorParameters ( new DownloadBehaviorDenied ( ) , options ? . UserContexts ) ;
7878
79- return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult ) . ConfigureAwait ( false ) ;
79+ return await ExecuteCommandAsync ( new SetDownloadBehaviorCommand ( @params ) , options , _jsonContext . SetDownloadBehaviorCommand , _jsonContext . SetDownloadBehaviorResult , cancellationToken ) . ConfigureAwait ( false ) ;
8080 }
8181
8282 protected override void Initialize ( BiDi bidi , JsonSerializerOptions jsonSerializerOptions )
0 commit comments