Reputation: 81
WebDriverWait wait = new WebDriverWait(_browser, TimeSpan.FromSeconds(0));
IWebElement textBoxByName = wait.Until(d => d.FindElement(By.Name((m.Groups["MethodValue"].Value))));
textBoxByName.SendKeys(m.Groups["Content"].Value.Replace("<SP>", " "));
I want to use wait.Until to wait until the element presents and found by selenium but it doesn't work and will through exception that the element can't be found because the element hasn't presented.
But if I use implicit wait to wait for certain seconds until the element displays I can find the element.
So I wonder how explicit wait works and if what is the correct way to wait until and element displays automatically.
Upvotes: 1
Views: 585
Reputation: 6950
You have set
TimeSpan.FromSeconds(0)
so it waits only for 0 seconds, i.e., doesnt wait at all. Try increasing that number and it should work.
Upvotes: 1