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

Method FindElement

dotnet/src/webdriver/ShadowRoot.cs:85–99  ·  view source on GitHub ↗

Finds the first using the given method. The locating mechanism to use. The first matching on the current context. If is . If no element matches th

(By by)

Source from the content-addressed store, hash-verified

83 /// <exception cref="ArgumentNullException">If <paramref name="by"/> is <see langword="null"/>.</exception>
84 /// <exception cref="NoSuchElementException">If no element matches the criteria.</exception>
85 public IWebElement FindElement(By by)
86 {
87 if (by is null)
88 {
89 throw new ArgumentNullException(nameof(by), "by cannot be null");
90 }
91
92 Dictionary<string, object?> parameters = new Dictionary<string, object?>();
93 parameters.Add("id", this.shadowRootId);
94 parameters.Add("using", by.Mechanism);
95 parameters.Add("value", by.Criteria);
96
97 Response commandResponse = this.driver.Execute(DriverCommand.FindShadowChildElement, parameters);
98 return this.driver.GetElementFromResponse(commandResponse)!;
99 }
100
101 /// <summary>
102 /// Finds all <see cref="IWebElement">IWebElements</see> within the current context

Callers

nothing calls this directly

Calls 3

AddMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected