Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Script/RemoteValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public sealed record HtmlCollectionRemoteValue : RemoteValue
public IReadOnlyList<RemoteValue>? Value { get; set; }
}

public sealed record NodeRemoteValue(string? SharedId, NodeProperties? Value) : RemoteValue, ISharedReference
public sealed record NodeRemoteValue(string SharedId, NodeProperties? Value) : RemoteValue, ISharedReference
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is nullable: https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnoderemotevalue

I also asked about it here: w3c/webdriver-bidi#868

I don't know how to deal with it.

{
public Handle? Handle { get; set; }

Expand Down
15 changes: 14 additions & 1 deletion dotnet/test/common/BiDi/Script/CallFunctionParameterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// </copyright>

using NUnit.Framework;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace OpenQA.Selenium.BiDi.Script;
Expand Down Expand Up @@ -104,7 +105,10 @@ public async Task CanCallFunctionToGetElement()

Assert.That(res, Is.Not.Null);
Assert.That(res.AsSuccessResult(), Is.AssignableFrom<NodeRemoteValue>());
Assert.That((res.AsSuccessResult() as NodeRemoteValue).Value, Is.Not.Null);

var node = (NodeRemoteValue)res.AsSuccessResult();
Assert.That(node.Value, Is.Not.Null);
Assert.That(node.SharedId, Is.EqualTo(GetElementId(By.Id("consoleLog"))));
}

[Test]
Expand Down Expand Up @@ -219,4 +223,13 @@ public async Task CanCallFunctionInARealm()
Assert.That(res1, Is.EqualTo(3));
Assert.That(res2, Is.EqualTo(5));
}

private string GetElementId(By selector)
{
var element = (WebElement)driver.FindElement(selector);
return ReflectElementId(element);

[UnsafeAccessor(UnsafeAccessorKind.Method, Name = "get_Id")]
static extern string ReflectElementId(WebElement element);
}
}