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

Method FindElements

dotnet/src/webdriver/ShadowRoot.cs:115–135  ·  view source on GitHub ↗

Finds all IWebElements within the current context using the given mechanism. The locating mechanism to use. A of all WebElements matching the current criteria, or an empty list if nothing matches. If

(By by)

Source from the content-addressed store, hash-verified

113 /// matching the current criteria, or an empty list if nothing matches.</returns>
114 /// <exception cref="ArgumentNullException">If <paramref name="by"/> is <see langword="null"/>.</exception>
115 public ReadOnlyCollection<IWebElement> FindElements(By by)
116 {
117 if (by is null)
118 {
119 throw new ArgumentNullException(nameof(by), "by cannot be null");
120 }
121
122 // Relative locators are resolved by a script, not by a find command.
123 if (by is RelativeBy)
124 {
125 return by.FindElements(this);
126 }
127
128 Dictionary<string, object?> parameters = new Dictionary<string, object?>();
129 parameters.Add("id", this.shadowRootId);
130 parameters.Add("using", by.Mechanism);
131 parameters.Add("value", by.Criteria);
132
133 Response commandResponse = this.driver.Execute(DriverCommand.FindShadowChildElements, parameters);
134 return this.driver.GetElementsFromResponse(commandResponse);
135 }
136
137 Dictionary<string, object> IWebDriverObjectReference.ToDictionary()
138 {

Callers

nothing calls this directly

Calls 3

AddMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected