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)
| 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 | // Relative locators are resolved by a script, not by a find command. |
| 93 | if (by is RelativeBy) |
| 94 | { |
| 95 | return by.FindElement(this); |
| 96 | } |
| 97 | |
| 98 | Dictionary<string, object?> parameters = new Dictionary<string, object?>(); |
| 99 | parameters.Add("id", this.shadowRootId); |
| 100 | parameters.Add("using", by.Mechanism); |
| 101 | parameters.Add("value", by.Criteria); |
| 102 | |
| 103 | Response commandResponse = this.driver.Execute(DriverCommand.FindShadowChildElement, parameters); |
| 104 | return this.driver.GetElementFromResponse(commandResponse)!; |
| 105 | } |
| 106 | |
| 107 | /// <summary> |
| 108 | /// Finds all <see cref="IWebElement">IWebElements</see> within the current context |
nothing calls this directly
no test coverage detected