Skip to content

Commit f650958

Browse files
add sessionId in option parameter
1 parent 90404e4 commit f650958

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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)