Skip to content

Commit 75f6eee

Browse files
authored
Merge pull request #2 from parthlambdatest/Dot-4397
[Dot-4397] add sessionId in option parameter
2 parents 6aac996 + 5c43553 commit 75f6eee

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

LambdaTest.Sdk.Utils/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static string GetSmartUIServerAddress()
99
var address = Environment.GetEnvironmentVariable("SMARTUI_SERVER_ADDRESS");
1010
if (string.IsNullOrEmpty(address))
1111
{
12-
throw new Exception("SmartUI server address not found");
12+
return "http://localhost:49152";
1313
}
1414
return address;
1515
}

LambdaTest.Selenium.Driver/SmartUI.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LambdaTest.Selenium.Driver
1010
{
1111
public static class SmartUISnapshot
1212
{
13-
private static readonly ILogger SmartUILogger = Logger.CreateLogger("Lambdatest.Selenium.Driver");
13+
private static readonly ILogger SmartUILogger = Logger.CreateLogger("Lambdatest.Selenium.Driver");
1414

1515
public static async Task CaptureSnapshot(IWebDriver driver, string name, Dictionary<string, object>? options = null)
1616
{
@@ -44,6 +44,18 @@ public static async Task CaptureSnapshot(IWebDriver driver, string name, Diction
4444

4545
((IJavaScriptExecutor)driver).ExecuteScript(script);
4646

47+
// Extract sessionId from driver
48+
string sessionId = (driver as IRemoteWebDriver)?.SessionId.ToString();
49+
if (!string.IsNullOrEmpty(sessionId))
50+
{
51+
// Append sessionId to options
52+
if (options == null)
53+
{
54+
options = new Dictionary<string, object>();
55+
}
56+
options["sessionId"] = sessionId;
57+
}
58+
4759
var optionsJSON = JsonSerializer.Serialize(options);
4860
var snapshotScript = @"
4961
var options = " + optionsJSON + @";

0 commit comments

Comments
 (0)