I am using Selenium Webdriver, and I want to verify that everything has loaded in a browser (Chrome as it happens). The browser main window will have 10 or more objects loading inside it (each within their own iframe). I want to ascertain as quickly as possible that each object has loaded, then carry on with the rest of the test. Is it possible to use the C# Parallel.foreach construct to speed things up here, or do I have to check in series.
Parallel.ForEach(loop, f=>
{
try
{
_customObject.MethodCheckingForAnIWebElement(f, AnArrayWithSomeInfo[f]);
}
catch (Exception e) { Console.WriteLine("Throw:" + f + ":" + e.Message); }
});
The code snippet above is throwing f-1 Element is not attached to the page object errors, which is making me think that I just cannot do this approach. To be clear, each call, I will do something like
_webDriver.SwitchTo().Frame(aFrame)
_webDriver.FindElement(By.CssSelector(some.property));
Apologies if I have missed some obvious documentation on this!