I am using TestStack's Selenium wrapper Seleno for UI testing. I seem to have stumbled upon some weird behavior that I am unable to determine the source of.
Say that I try to find an element that may or may not exist in the DOM:
public void FindStuffByCss(string selector)
{
Find.OptionalElement(By.CssSelector(selector), TimeSpan.FromMilliseconds(200));
}
I would expect this function to time out after 200 milliseconds if it doesn't find any elements in the DOM, but it actually takes 10 seconds! At first, I thought this was because of the cssSelector I used, but it doesn't seem like that's the case.. Because the following times out after 500 milliseconds:
public void FindStuffByJquery(string selector)
{
Find.OptionalElement(By.jQuery(selector), TimeSpan.FromMilliseconds(200));
}
Unless JQuery is 20 times faster than whatever Selenium/Seleno uses to perform its By.CssSelector query, this is a little odd. To me it looks like there is a default minimum timeout that you cannot override.
Has anyone noticed similar behaviour? I would really like to know why, and if there is a way to override it.