MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / TryCreate

Method TryCreate

dotnet/src/webdriver/ShadowRoot.cs:61–76  ·  view source on GitHub ↗
(WebDriver parentDriver, Dictionary<string, object?> shadowRootDictionary, [NotNullWhen(true)] out ShadowRoot? shadowRoot)

Source from the content-addressed store, hash-verified

59 string IWebDriverObjectReference.ObjectReferenceId => this.shadowRootId;
60
61 internal static bool TryCreate(WebDriver parentDriver, Dictionary<string, object?> shadowRootDictionary, [NotNullWhen(true)] out ShadowRoot? shadowRoot)
62 {
63 if (shadowRootDictionary is null)
64 {
65 throw new ArgumentNullException(nameof(shadowRootDictionary), "The dictionary containing the shadow root reference cannot be null");
66 }
67
68 if (shadowRootDictionary.TryGetValue(ShadowRootReferencePropertyName, out object? shadowRootValue))
69 {
70 shadowRoot = new ShadowRoot(parentDriver, shadowRootValue?.ToString()!);
71 return true;
72 }
73
74 shadowRoot = null;
75 return false;
76 }
77
78 /// <summary>
79 /// Finds the first <see cref="IWebElement"/> using the given method.

Callers 4

CreateCommandUriMethod · 0.80
GetShadowRootMethod · 0.80
AsBiDiAsyncMethod · 0.80

Calls 1

TryGetValueMethod · 0.45

Tested by

no test coverage detected