Skip to content

Commit 4d6c06f

Browse files
kamal-kaur04francisf
authored andcommitted
minor updates
1 parent 9e0c433 commit 4d6c06f

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

playwright-dotnet/PlaywrightSessionDetailsTest.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public static async Task main(string[] args)
4141
await MarkTestStatus("failed", "Title did not match", page);
4242
}
4343
Object sessionObject = await page.EvaluateAsync("_ => {}", "browserstack_executor: {\"action\":\"getSessionDetails\"}");
44-
Console.WriteLine(sessionObject);
4544

4645
// convert Object to String for parsing
4746
string? json_resp = Convert.ToString(sessionObject);
@@ -51,8 +50,8 @@ public static async Task main(string[] args)
5150
{
5251
var session_details = JObject.Parse(json_resp);
5352

54-
// print the session ID on IDE's console
55-
Console.WriteLine(session_details["hashed_id"]);
53+
// print the session Details on IDE's console
54+
Console.WriteLine("GetSessionDetails response: \n" + session_details);
5655
}
5756
}
5857
catch (Exception err) {

playwright-java/src/test/java/com/browserstack/PlaywrightSessionDetailsTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,12 @@ public static void main(String[] args) {
4141

4242
// store the JSON response in the Object class
4343
Object response = page.evaluate("_ => {}", "browserstack_executor: {\"action\": \"getSessionDetails\"}");
44-
System.out.println(response);
4544

4645
// parse the JSON response
47-
JsonObject json = JsonParser.parseString((String) response).getAsJsonObject();
46+
JsonObject sessionDetails = JsonParser.parseString((String) response).getAsJsonObject();
4847

49-
// store session ID in a variable
50-
String sessionID = String.valueOf(json.get("hashed_id"));
51-
52-
// print session ID in your IDE's console
53-
System.out.println(sessionID);
48+
// print session Details in your IDE's console
49+
System.out.println("GetSessionDetails response: \n" + sessionDetails);
5450
} catch (Exception err) {
5551
markTestStatus("failed", err.getMessage(), page);
5652
}

playwright-python/session-details-playwright-test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ def run_session(playwright):
3232

3333
# get details of the session
3434
response = page.evaluate("_=> {}", 'browserstack_executor: {"action": "getSessionDetails"}')
35-
print(response)
3635

37-
jsonResponse = json.loads(response)
36+
session_details= json.loads(response)
3837

39-
# print the session ID in the IDE's console
40-
print(jsonResponse["hashed_id"])
38+
# print the session Details in the IDE's console
39+
print("GetSessionDetails response: \n", session_details)
4140

4241
except Exception as err:
4342
mark_test_status("failed", str(err), page)

0 commit comments

Comments
 (0)