The user should have the option to validate that an element exists/is visible/etc in the DOM immediately
. This is currently not possible with the standard WebUI.verifyElement____ methods, as providing a timeout of '0' seems to default back to the 30 second timeout, and often the next best option (waiting 1 second) is not viable.
Take for example the following scenario, which should demonstrate that waiting 1 second is not a good alternative:
We would like to test a form that contains many, many fields. I write an algorithm (Custom Keyword) that goes something like: "given a set of values provided by the user, if the field is currently present
, set the field to the given value". Now lets say that the user provides me with 300 values they would like to set, but only 150 fields exist on the page. Using the current WebUI.verifyElementPresent(myFieldObject, 1) implementation, we now have to wait an extra 150 seconds (1 second timeout for each field not in the DOM).
We currently have to fall back to the Selenium standard approach for doing this kind of thing:
String xpath = object.findPropertyValue("xpath");
return DriverFactory.getWebDriver().findElements(By.xpath(xpath)).size() > 0;
The solution is to either implement a separate verifyElementPresent that does not take a timeout argument, or, as I've said, to make an argument of '0' do what it's supposed to do (return immediately).
Thank you in advance!