Closed NickAb closed 9 years ago
Both FindAll
and FindFirst
are prone to this exception, which is raised when trying to find elements in WebView that has loaded its data recently, exception is thrown when methods try to build cache, so it might be due to trying to iterate visual tree while it is being rebuild by another thread.
Replacing FindAll
with
private IEnumerable<WiniumElement> GetChildrens()
{
var elementNode = TreeWalker.ControlViewWalker.GetFirstChild(this.AutomationElement);
while (elementNode != null)
{
yield return new WiniumElement(elementNode);
elementNode = TreeWalker.ControlViewWalker.GetNextSibling(elementNode);
}
}
Solves the problem. Needs further investigation. Most likely we will have to replace both FindFirst
and FindAll
calls with custom TreeWalker iteration method.
This will solve the problem with not being able to get page source for views with webviews and not being able to find element in webview due to same error.
Some times GetPageSource method throws ElementNotAvailableException