2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 ,  Florent  Castelli  < florent . castelli @ gmail . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 ,  Sam  Atkins  < atkinssj @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-15 14:08:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 ,  Tobias  Christiansen  < tobyase @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:19:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 ,  Linus  Groh  < linusg @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-29 09:40:17 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 - 2024 ,  Tim  Flynn  < trflynn89 @ ladybird . org > 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 *  SPDX - License - Identifier :  BSD - 2 - Clause 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/Debug.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-11-11 13:58:20 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/JsonObject.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/JsonValue.h> 
  
						 
					
						
							
								
									
										
										
										
											2024-10-21 14:42:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibCore/EventLoop.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibCore/Timer.h> 
  
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Crypto/Crypto.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:57:14 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/WebDriver/Capabilities.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-10-19 17:46:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <WebDriver/Client.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								namespace  WebDriver  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								HashMap < String ,  NonnullRefPtr < Session > >  Client : : s_sessions ;  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 18:09:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								ErrorOr < NonnullRefPtr < Client > >  Client : : try_create ( NonnullOwnPtr < Core : : BufferedTCPSocket >  socket ,  LaunchBrowserCallbacks  callbacks ,  Core : : EventReceiver *  parent )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-12-15 08:46:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! callbacks . launch_browser  | |  ! callbacks . launch_headless_browser ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-05 15:06:15 +04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  Error : : from_string_literal ( " All callbacks to launch a browser must be provided " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-15 08:46:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    TRY ( socket - > set_blocking ( true ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-15 08:46:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  adopt_nonnull_ref_or_enomem ( new  ( nothrow )  Client ( move ( socket ) ,  move ( callbacks ) ,  parent ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 18:09:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Client : : Client ( NonnullOwnPtr < Core : : BufferedTCPSocket >  socket ,  LaunchBrowserCallbacks  callbacks ,  Core : : EventReceiver *  parent )  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    :  Web : : WebDriver : : Client ( move ( socket ) ,  parent ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-15 08:46:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ,  m_callbacks ( move ( callbacks ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Client : : ~ Client ( )  =  default ;  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:53:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								ErrorOr < NonnullRefPtr < Session > ,  Web : : WebDriver : : Error >  Client : : find_session_with_id ( StringView  session_id ,  AllowInvalidWindowHandle  allow_invalid_window_handle )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( auto  session  =  s_sessions . get ( session_id ) ;  session . has_value ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:53:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( allow_invalid_window_handle  = =  AllowInvalidWindowHandle : : No ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            TRY ( session . value ( ) - > ensure_current_window_handle_is_valid ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  * session . release_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:53:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-08 10:10:27 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : InvalidSessionId ,  " Invalid session id " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  Client : : close_session ( String  const &  session_id )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( s_sessions . remove ( session_id ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        dbgln_if ( WEBDRIVER_DEBUG ,  " Shut down session {} " ,  session_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        dbgln_if ( WEBDRIVER_DEBUG ,  " Unable to shut down session {}: Not found " ,  session_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 8.1 New Session, https://w3c.github.io/webdriver/#dfn-new-sessions
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session
  
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:57:14 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : new_session ( Web : : WebDriver : : Parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 1. If the maximum active sessions is equal to the length of the list of active sessions,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           return error with error code session not created.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 2. If the remote end is an intermediary node, take implementation-defined steps that either
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           result in returning an error with error code session not created, or in returning a
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           success with data that is isomorphic to that returned by remote ends according to the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           rest of this algorithm. If an error is not returned, the intermediary node must retain a
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           reference to the session created on the upstream node as the associated session such
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           that commands may be forwarded to this associated session on subsequent commands.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 3. If the maximum active sessions is equal to the length of the list of active sessions,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           return error with error code session not created.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:57:14 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // 4. Let capabilities be the result of trying to process capabilities with parameters as an argument.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  capabilities  =  TRY ( Web : : WebDriver : : process_capabilities ( payload ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:57:14 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								    // 5. If capabilities’  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( capabilities . is_null ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : SessionNotCreated ,  " Could not match capabilities " sv ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 6. Let session id be the result of generating a UUID.
 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session_id  =  MUST ( Web : : Crypto : : generate_random_uuid ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 7. Let session be a new session with the session ID of session id.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-22 07:38:07 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Web : : WebDriver : : LadybirdOptions  options  {  capabilities . as_object ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  make_ref_counted < Session > ( session_id ,  * this ,  move ( options ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-22 07:38:07 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-15 08:46:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( auto  start_result  =  session - > start ( m_callbacks ) ;  start_result . is_error ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-16 17:49:34 +03:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : SessionNotCreated ,  ByteString : : formatted ( " Failed to start session: {} " ,  start_result . error ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-08 10:42:12 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  web_content_connection  =  session - > web_content_connection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 8. Set the current session to session.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 9. Run any WebDriver new session algorithm defined in external specifications,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //           with arguments session and capabilities.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 10. Append session to active sessions.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-04 08:37:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    s_sessions . set ( session_id ,  session ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 16:27:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // NOTE: We do step 12 before 11 because step 12 mutates the capabilities we set in step 11.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 12. Initialize the following from capabilities:
 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-04 08:37:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    session - > initialize_from_capabilities ( capabilities . as_object ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 16:27:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 11. Let body be a JSON Object initialized with:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    JsonObject  body ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:29:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "sessionId"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //     session id
 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 11:07:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    body . set ( " sessionId " ,  JsonValue  {  session_id  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:29:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "capabilities"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //     capabilities
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    body . set ( " capabilities " ,  move ( capabilities ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-08 10:42:12 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // 13. Set the webdriver-active flag to true.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    web_content_connection . async_set_is_webdriver_active ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 14. Set the current top-level browsing context for session with the top-level browsing context
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    //            of the UA’  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: 15. Set the request queue to a new queue.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 16. Return success with data body.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-13 00:52:44 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  JsonValue  {  move ( body )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 8.2 Delete Session, https://w3c.github.io/webdriver/#dfn-delete-session
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// DELETE /session/{session id}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : delete_session ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling DELETE /session/<session_id> " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 1. If the current session is an active session, try to close the session.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-01 13:08:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( auto  session  =  find_session_with_id ( parameters [ 0 ] ,  AllowInvalidWindowHandle : : Yes ) ;  ! session . is_error ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-19 13:36:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        close_session ( session . value ( ) - > session_id ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 2. Return success with data null.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-13 00:52:44 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  JsonValue  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 8.3 Status, https://w3c.github.io/webdriver/#dfn-status
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /status
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_status ( Web : : WebDriver : : Parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /status " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-07 17:17:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // 1. Let body be a new JSON Object with the following properties:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //    "ready"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    //        The remote end’  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //    "message"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    //        An implementation-defined string explaining the remote end’  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: Report if we are somehow not ready.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    JsonObject  body ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    body . set ( " ready " ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    body . set ( " message " ,  " Ready to start some sessions! " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 2. Return success with data body.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-08 09:42:36 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  JsonValue  {  body  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 17:46:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 9.1 Get Timeouts, https://w3c.github.io/webdriver/#dfn-get-timeouts
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/timeouts
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_timeouts ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 17:46:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session id>/timeouts " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-11 14:28:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > web_content_connection ( ) . get_timeouts ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 17:46:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 18:07:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 9.2 Set Timeouts, https://w3c.github.io/webdriver/#dfn-set-timeouts
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/timeouts
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : set_timeouts ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 18:07:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session id>/timeouts " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-04 08:37:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > set_timeouts ( move ( payload ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 18:07:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.1 Navigate To, https://w3c.github.io/webdriver/#dfn-navigate-to
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/url
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : navigate_to ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/url " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . navigate_to ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.2 Get Current URL, https://w3c.github.io/webdriver/#dfn-get-current-url
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/url
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_current_url ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/url " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_current_url ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.3 Back, https://w3c.github.io/webdriver/#dfn-back
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/back
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : back ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/back " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . back ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.4 Forward, https://w3c.github.io/webdriver/#dfn-forward
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/forward
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : forward ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/forward " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . forward ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.5 Refresh, https://w3c.github.io/webdriver/#dfn-refresh
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/refresh
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : refresh ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-14 18:09:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/refresh " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . refresh ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-14 18:09:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 10.6 Get Title, https://w3c.github.io/webdriver/#dfn-get-title
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/title
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_title ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-15 18:15:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/title " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_title ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-15 18:15:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:19:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.1 Get Window Handle, https://w3c.github.io/webdriver/#get-window-handle
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/window
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_window_handle ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:19:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/window " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-06 01:57:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 11:29:14 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // 1. If the current top-level browsing context is no longer open, return error with error code no such window.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    TRY ( session - > web_content_connection ( ) . ensure_top_level_browsing_context_is_open ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-06 01:57:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 2. Return success with data being the window handle associated with the current top-level browsing context.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  JsonValue  {  session - > current_window_handle ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 22:19:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.2 Close Window, https://w3c.github.io/webdriver/#dfn-close-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// DELETE /session/{session id}/window
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : close_window ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-15 18:18:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:19:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling DELETE /session/<session_id>/window " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-06 01:57:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > close_window ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-15 18:18:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-24 20:32:53 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.3 Switch to Window, https://w3c.github.io/webdriver/#dfn-switch-to-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : switch_to_window ( Web : : WebDriver : : Parameters  parameters ,  AK : : JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:53:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ,  AllowInvalidWindowHandle : : Yes ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-06 01:57:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! payload . is_object ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : InvalidArgument ,  " Payload is not a JSON object " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 1. Let handle be the result of getting the property "handle" from the parameters argument.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  handle  =  payload . as_object ( ) . get ( " handle " sv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // 2. If handle is undefined, return error with error code invalid argument.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! handle . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : InvalidArgument ,  " No property called 'handle' present " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-06 15:49:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > switch_to_window ( handle - > as_string ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-24 20:32:53 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 21:41:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.4 Get Window Handles, https://w3c.github.io/webdriver/#dfn-get-window-handles
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/window/handles
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_window_handles ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 21:41:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/window/handles " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:53:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ,  AllowInvalidWindowHandle : : Yes ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-06 01:57:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > get_window_handles ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 21:41:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 14:09:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.5 New Window, https://w3c.github.io/webdriver/#dfn-new-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/new
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : new_window ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/new " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 14:42:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  handle  =  TRY ( session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . new_window ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    static  constexpr  u32  CONNECTION_TIMEOUT_MS  =  5000 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-21 14:42:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  timeout_fired  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  timer  =  Core : : Timer : : create_single_shot ( CONNECTION_TIMEOUT_MS ,  [ & timeout_fired ]  {  timeout_fired  =  true ;  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    timer - > start ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Core : : EventLoop : : current ( ) . spin_until ( [ & session ,  & timeout_fired ,  handle  =  handle . as_object ( ) . get ( " handle " sv ) - > as_string ( ) ] ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  session - > has_window_handle ( handle )  | |  timeout_fired ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( timeout_fired ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  Web : : WebDriver : : Error : : from_code ( Web : : WebDriver : : ErrorCode : : Timeout ,  " Timed out waiting for window handle " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  handle ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 14:09:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.6 Switch To Frame, https://w3c.github.io/webdriver/#dfn-switch-to-frame
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/frame
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : switch_to_frame ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2024-09-08 08:14:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/frame " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . switch_to_frame ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// 11.7 Switch To Parent Frame, https://w3c.github.io/webdriver/#dfn-switch-to-parent-frame
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/frame/parent
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : switch_to_parent_frame ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2024-09-08 08:14:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/frame/parent " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . switch_to_parent_frame ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:19:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.8.1 Get Window Rect, https://w3c.github.io/webdriver/#dfn-get-window-rect
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/window/rect
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_window_rect ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:19:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/window/rect " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_window_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:19:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:33:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.8.2 Set Window Rect, https://w3c.github.io/webdriver/#dfn-set-window-rect
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/rect
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : set_window_rect ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:33:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/rect " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . set_window_rect ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:33:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:44:43 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.8.3 Maximize Window, https://w3c.github.io/webdriver/#dfn-maximize-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/maximize
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : maximize_window ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:44:43 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/maximize " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . maximize_window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 09:44:43 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:01:51 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.8.4 Minimize Window, https://w3c.github.io/webdriver/#minimize-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/minimize
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : minimize_window ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:01:51 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/minimize " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . minimize_window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:01:51 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-09 19:09:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 11.8.5 Fullscreen Window, https://w3c.github.io/webdriver/#dfn-fullscreen-window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/fullscreen
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : fullscreen_window ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-09 19:09:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/fullscreen " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . fullscreen_window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-09 19:09:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 11:14:42 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// Extension: Consume User Activation, https://html.spec.whatwg.org/multipage/interaction.html#user-activation-user-agent-automation
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/window/consume-user-activation
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : consume_user_activation ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/window/consume-user-activation " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > web_content_connection ( ) . consume_user_activation ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 12:47:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_element ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-18 12:47:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_element ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 12:47:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:21:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.3 Find Elements, https://w3c.github.io/webdriver/#dfn-find-elements
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/elements
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_elements ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:21:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/elements " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_elements ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:21:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:51:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.4 Find Element From Element, https://w3c.github.io/webdriver/#dfn-find-element-from-element
  
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:19:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element/{element id}/element
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_element_from_element ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:51:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element/<element_id>/element " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_element_from_element ( move ( payload ) ,  move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:51:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:52:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.5 Find Elements From Element, https://w3c.github.io/webdriver/#dfn-find-elements-from-element
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element/{element id}/elements
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_elements_from_element ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:52:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element/<element_id>/elements " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_elements_from_element ( move ( payload ) ,  move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 13:52:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:48:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.6 Find Element From Shadow Root, https://w3c.github.io/webdriver/#find-element-from-shadow-root
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/shadow/{shadow id}/element
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_element_from_shadow_root ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/shadow/<shadow_id>/element " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_element_from_shadow_root ( move ( payload ) ,  move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:48:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:54:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.7 Find Elements From Shadow Root, https://w3c.github.io/webdriver/#find-elements-from-shadow-root
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/shadow/{shadow id}/elements
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : find_elements_from_shadow_root ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/shadow/<shadow_id>/elements " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . find_elements_from_shadow_root ( move ( payload ) ,  move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:54:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:02:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.8 Get Active Element, https://w3c.github.io/webdriver/#get-active-element
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/active
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_active_element ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/active " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_active_element ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:02:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:27:11 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.3.9 Get Element Shadow Root, https://w3c.github.io/webdriver/#get-element-shadow-root
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/shadow
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_shadow_root ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/shadow " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_shadow_root ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 19:27:11 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 17:05:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.1 Is Element Selected, https://w3c.github.io/webdriver/#dfn-is-element-selected
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/selected
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : is_element_selected ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-03 17:05:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/selected " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . is_element_selected ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 17:05:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 16:58:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.2 Get Element Attribute, https://w3c.github.io/webdriver/#dfn-get-element-attribute
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/attribute/{name}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_attribute ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 16:58:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/attribute/<name> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_attribute ( move ( parameters [ 1 ] ) ,  move ( parameters [ 2 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 16:58:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 20:46:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.3 Get Element Property, https://w3c.github.io/webdriver/#dfn-get-element-property
  
						 
					
						
							
								
									
										
										
										
											2022-11-02 10:19:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/property/{name}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_property ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-19 20:46:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/property/<name> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_property ( move ( parameters [ 1 ] ) ,  move ( parameters [ 2 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 20:46:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-20 12:06:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.4 Get Element CSS Value, https://w3c.github.io/webdriver/#dfn-get-element-css-value
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/css/{property name}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_css_value ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-20 12:06:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/css/<property_name> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_css_value ( move ( parameters [ 1 ] ) ,  move ( parameters [ 2 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-20 12:06:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 10:12:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.5 Get Element Text, https://w3c.github.io/webdriver/#dfn-get-element-text
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/text
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_text ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-01 10:12:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/text " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_text ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 10:12:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-20 22:40:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/name
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_tag_name ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-20 22:40:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/name " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_tag_name ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-20 22:40:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 12:53:27 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/rect
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_element_rect ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-03 12:53:27 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/rect " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_element_rect ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 12:53:27 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 13:31:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.8 Is Element Enabled, https://w3c.github.io/webdriver/#dfn-is-element-enabled
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/enabled
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : is_element_enabled ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-03 13:31:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/enabled " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . is_element_enabled ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 13:31:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 10:26:08 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.9 https://w3c.github.io/webdriver/#dfn-get-computed-role
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/computedrole
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_computed_role ( Web : : WebDriver : : Parameters  parameters ,  AK : : JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session id>/element/<element id>/computedrole " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_computed_role ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 10:26:08 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-19 11:36:08 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.4.10 Get Computed Label, https://w3c.github.io/webdriver/#get-computed-label
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/computedlabel
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_computed_label ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session id>/element/<element id>/computedlabel " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_computed_label ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-19 11:36:08 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-24 02:17:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.5.1 Element Click, https://w3c.github.io/webdriver/#element-click
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element/{element id}/click
  
						 
					
						
							
								
									
										
										
										
											2023-01-26 14:11:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : element_click ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-12-24 02:17:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element/<element_id>/click " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . element_click ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-24 02:17:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 12.5.2 Element Clear, https://w3c.github.io/webdriver/#dfn-element-clear
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element/{element id}/clear
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : element_clear ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2024-09-08 08:14:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element/<element_id>/clear " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . element_clear ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// 12.5.3 Element Send Keys, https://w3c.github.io/webdriver/#dfn-element-send-keys
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/element/{element id}/value
  
						 
					
						
							
								
									
										
										
										
											2024-09-25 11:26:46 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : element_send_keys ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2024-09-08 08:14:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/element/<element_id>/value " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . element_send_keys ( move ( parameters [ 1 ] ) ,  move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-07 12:41:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 20:26:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 13.1 Get Page Source, https://w3c.github.io/webdriver/#dfn-get-page-source
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/source
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_source ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 20:26:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/source " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_source ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 20:26:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:11:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 13.2.1 Execute Script, https://w3c.github.io/webdriver/#dfn-execute-script
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/execute/sync
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : execute_script ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:11:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/execute/sync " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . execute_script ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:11:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 13.2.2 Execute Async Script, https://w3c.github.io/webdriver/#dfn-execute-async-script
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/execute/async
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : execute_async_script ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/execute/async " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . execute_async_script ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 18:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 14.1 Get All Cookies, https://w3c.github.io/webdriver/#dfn-get-all-cookies
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/cookie
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_all_cookies ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-15 14:08:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/cookie " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_all_cookies ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-15 14:08:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 14.2 Get Named Cookie, https://w3c.github.io/webdriver/#dfn-get-named-cookie
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/cookie/{name}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_named_cookie ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-15 19:22:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/cookie/<name> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . get_named_cookie ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-15 19:22:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 14.3 Add Cookie, https://w3c.github.io/webdriver/#dfn-adding-a-cookie
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/cookie
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : add_cookie ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-10-17 13:20:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/cookie " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . add_cookie ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 13:20:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 14.4 Delete Cookie, https://w3c.github.io/webdriver/#dfn-delete-cookie
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// DELETE /session/{session id}/cookie/{name}
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : delete_cookie ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-16 19:55:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling DELETE /session/<session_id>/cookie/<name> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . delete_cookie ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-16 19:55:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:12:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 14.5 Delete All Cookies, https://w3c.github.io/webdriver/#dfn-delete-all-cookies
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// DELETE /session/{session id}/cookie
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : delete_all_cookies ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-10-16 19:55:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling DELETE /session/<session_id>/cookie " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-03 09:39:18 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . delete_all_cookies ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-16 19:55:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-02 14:41:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 15.7 Perform Actions, https://w3c.github.io/webdriver/#perform-actions
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/actions
  
						 
					
						
							
								
									
										
										
										
											2024-09-25 11:26:46 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : perform_actions ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2024-09-02 14:41:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/actions " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . perform_actions ( move ( payload ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-02 14:41:24 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 17:36:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 15.8 Release Actions, https://w3c.github.io/webdriver/#release-actions
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// DELETE /session/{session id}/actions
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : release_actions ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling DELETE /session/<session_id>/actions " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 09:38:43 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . release_actions ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 17:36:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 07:15:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 16.1 Dismiss Alert, https://w3c.github.io/webdriver/#dismiss-alert
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/alert/dismiss
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : dismiss_alert ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/alert/dismiss " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . dismiss_alert ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 07:15:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 07:24:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 16.2 Accept Alert, https://w3c.github.io/webdriver/#accept-alert
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/alert/accept
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : accept_alert ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/alert/accept " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . accept_alert ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 07:24:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 08:26:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 16.3 Get Alert Text, https://w3c.github.io/webdriver/#get-alert-text
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/alert/text
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : get_alert_text ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/alert/text " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 08:26:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > web_content_connection ( ) . get_alert_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 08:57:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 16.4 Send Alert Text, https://w3c.github.io/webdriver/#send-alert-text
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/alert/text
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : send_alert_text ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session_id>/alert/text " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 08:57:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > web_content_connection ( ) . send_alert_text ( payload ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 12:59:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 17.1 Take Screenshot, https://w3c.github.io/webdriver/#take-screenshot
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/screenshot
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : take_screenshot ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-02 12:59:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/screenshot " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . take_screenshot ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 12:59:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-04 20:28:42 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 17.2 Take Element Screenshot, https://w3c.github.io/webdriver/#dfn-take-element-screenshot
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// GET /session/{session id}/element/{element id}/screenshot
  
						 
					
						
							
								
									
										
										
										
											2022-11-12 23:37:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : take_element_screenshot ( Web : : WebDriver : : Parameters  parameters ,  JsonValue )  
						 
					
						
							
								
									
										
										
										
											2022-11-04 20:28:42 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling GET /session/<session_id>/element/<element_id>/screenshot " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-01 07:42:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > perform_async_action ( [ & ] ( auto &  connection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  connection . take_element_screenshot ( move ( parameters [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-04 20:28:42 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-27 00:30:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// 18.1 Print Page, https://w3c.github.io/webdriver/#dfn-print-page
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								// POST /session/{session id}/print
  
						 
					
						
							
								
									
										
										
										
											2024-09-25 11:26:46 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Web : : WebDriver : : Response  Client : : print_page ( Web : : WebDriver : : Parameters  parameters ,  JsonValue  payload )  
						 
					
						
							
								
									
										
										
										
											2022-11-27 00:30:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    dbgln_if ( WEBDRIVER_DEBUG ,  " Handling POST /session/<session id>/print " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 10:36:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  session  =  TRY ( find_session_with_id ( parameters [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-25 11:26:46 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  session - > web_content_connection ( ) . print_page ( move ( payload ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-27 00:30:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 11:14:59 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}