File tree Expand file tree Collapse file tree 2 files changed +24
-24
lines changed
Expand file tree Collapse file tree 2 files changed +24
-24
lines changed Original file line number Diff line number Diff line change @@ -40,25 +40,24 @@ public static async Task main(string[] args)
4040 {
4141 await MarkTestStatus ( "failed" , "Title did not match" , page ) ;
4242 }
43+ Object sessionObject = await page . EvaluateAsync ( "_ => {}" , "browserstack_executor: {\" action\" :\" getSessionDetails\" }" ) ;
44+ Console . WriteLine ( sessionObject ) ;
45+
46+ // convert Object to String for parsing
47+ string ? json_resp = Convert . ToString ( sessionObject ) ;
48+
49+ // parse the data
50+ if ( json_resp != null )
51+ {
52+ var session_details = JObject . Parse ( json_resp ) ;
53+
54+ // print the session ID on IDE's console
55+ Console . WriteLine ( session_details [ "hashed_id" ] ) ;
56+ }
4357 }
4458 catch ( Exception err ) {
4559 await MarkTestStatus ( "failed" , err . Message , page ) ;
4660 }
47- Object sessionObject = await page . EvaluateAsync ( "_ => {}" , "browserstack_executor: {\" action\" :\" getSessionDetails\" }" ) ;
48- Console . WriteLine ( sessionObject ) ;
49-
50- // convert Object to String for parsing
51- string ? json_resp = Convert . ToString ( sessionObject ) ;
52-
53- // parse the data
54- if ( json_resp != null )
55- {
56- var session_details = JObject . Parse ( json_resp ) ;
57-
58- // print the session ID on IDE's console
59- Console . WriteLine ( session_details [ "hashed_id" ] ) ;
60- }
61-
6261 await browser . CloseAsync ( ) ;
6362 }
6463
Original file line number Diff line number Diff line change @@ -29,18 +29,19 @@ def run_session(playwright):
2929 mark_test_status ("passed" , "Title matched" , page )
3030 else :
3131 mark_test_status ("failed" , "Title did not match" , page )
32+
33+ # get details of the session
34+ response = page .evaluate ("_=> {}" , 'browserstack_executor: {"action": "getSessionDetails"}' )
35+ print (response )
36+
37+ jsonResponse = json .loads (response )
38+
39+ # print the session ID in the IDE's console
40+ print (jsonResponse ["hashed_id" ])
41+
3242 except Exception as err :
3343 mark_test_status ("failed" , str (err ), page )
3444
35- # get details of the session
36- response = page .evaluate ("_=> {}" , 'browserstack_executor: {"action": "getSessionDetails"}' )
37- print (response )
38-
39- jsonResponse = json .loads (response )
40-
41- # print the session ID in the IDE's console
42- print (jsonResponse ["hashed_id" ])
43-
4445 browser .close ()
4546
4647def mark_test_status (status , reason , page ):
You can’t perform that action at this time.
0 commit comments