Invariants can be used to perform tests on the current state
addInvariant(String description, Condition condition)
addInvariant(String description, Condition condition, Condition...preConditions)
Use the generic conditions
addInvariant("No error messages", new NotRegexCondition("Error [0-9]+");
Create your own condition
crawler.addInvariant("Test count myList", new ConditionAbstract(){
@Override
public boolean check(EmbeddedBrowser browser) {
WebDriver driver = browser.getDriver();
try{
WebElement myList = driver.findElement(By.id("myList"));
return new Select(myList).getOptions().size() > 0;
}catch(NoSuchElementException e){
//not found
return true;
}
}
});