Selenium waitForCondition Selenium waitForCondition selenium selenium

Selenium waitForCondition


waitForCondition is for Javascript calls only, not for waiting for elements to load.

What you have in isElementPresent is fine. I would combine it with explicit waits to be a bit more accurate about when an element is actually loaded and present on the screen:

http://seleniumhq.org/docs/04_webdriver_advanced.html


C#

You can do it like this:

First of all you can set timeout value for the condition.

Then you can use the condition.

var Wait = new WebDriverWait(GlobalDriver, TimeSpan.FromMinutes(1));Wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.XPath("xPath"))));

OR

Wait.Until(driver => driver.FindElement(By.XPath("xPath")));

Thats all.


You can do it like this :

selenium.waitForCondition("selenium.isElementPresent(\"//input[@name='Report']\")", "30000");

This will wait for the element to be loaded till 30 seconds.