11use serde_json:: Value ;
2- use std:: fmt;
3- use std:: fmt:: { Debug , Formatter } ;
42use std:: future:: Future ;
53use std:: path:: Path ;
64use std:: time:: Duration ;
@@ -10,10 +8,9 @@ use tokio::io::AsyncWriteExt;
108use fantoccini:: cookies:: Cookie ;
119use fantoccini:: elements:: Element ;
1210use fantoccini:: error:: CmdError ;
13- use fantoccini:: wd:: { Capabilities , TimeoutConfiguration , WebDriverStatus , WindowHandle } ;
11+ use fantoccini:: wd:: { TimeoutConfiguration , WebDriverStatus , WindowHandle } ;
1412
1513use crate :: action_chain:: ActionChain ;
16- use crate :: common:: config:: WebDriverConfig ;
1714use crate :: error:: { WebDriverError , WebDriverResult } ;
1815use crate :: session:: scriptret:: ScriptRet ;
1916use crate :: { By , Rect , SessionId , SwitchTo , WebElement } ;
@@ -23,26 +20,23 @@ use crate::{By, Rect, SessionId, SwitchTo, WebElement};
2320#[ derive( Clone ) ]
2421pub struct SessionHandle {
2522 pub client : fantoccini:: Client ,
26- pub config : WebDriverConfig ,
23+ pub session_id : String ,
2724}
2825
29- impl Debug for SessionHandle {
30- fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
31- write ! ( f , "{}" , self . config . get_session_id ( ) )
26+ impl std :: fmt :: Debug for SessionHandle {
27+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt:: Result {
28+ f . debug_struct ( "SessionHandle" ) . field ( "session_id" , & self . session_id ) . finish ( )
3229 }
3330}
3431
3532impl SessionHandle {
3633 /// Create new SessionHandle from a fantoccini Client.
3734 #[ allow( dead_code) ]
38- pub ( crate ) async fn new (
39- client : fantoccini:: Client ,
40- capabilities : Capabilities ,
41- ) -> WebDriverResult < Self > {
35+ pub ( crate ) async fn new ( client : fantoccini:: Client ) -> WebDriverResult < Self > {
4236 let session_id = client. session_id ( ) . await ?. expect ( "session id to be valid" ) ;
4337 Ok ( Self {
4438 client,
45- config : WebDriverConfig :: new ( SessionId :: from ( session_id) , capabilities ) ,
39+ session_id,
4640 } )
4741 }
4842
@@ -51,24 +45,12 @@ impl SessionHandle {
5145 WebElement :: new ( element, self . clone ( ) )
5246 }
5347
54- /// Return a clone of the capabilities as originally requested.
55- pub fn capabilities ( & mut self ) -> Capabilities {
56- self . config . get_capabilities ( )
57- }
58-
5948 /// Get the session ID.
6049 pub async fn session_id ( & self ) -> WebDriverResult < SessionId > {
6150 let id = self . client . session_id ( ) . await ?;
6251 Ok ( SessionId :: from ( id. unwrap_or_default ( ) ) )
6352 }
6453
65- /// Get a clone of the `WebDriverConfig`.
66- ///
67- /// You can update the config by modifying it directly.
68- pub fn config ( & self ) -> WebDriverConfig {
69- self . config . clone ( )
70- }
71-
7254 /// Get the WebDriver status.
7355 ///
7456 /// # Example
0 commit comments