registerPage.gotoPage();
// Switch LiveValidation on or off as needed.
int x = 0;
while (registerPage.liveValidationEnabled() != useLiveValidation()) {
AdministrationSectionPage sectionPage = new AdministrationSectionPage("Registration");
getDriver().get(getUtil().getURLToLoginAsAdminAndGotoPage(sectionPage.getURL()));
getUtil().recacheSecretToken();
getUtil().assertOnPage(sectionPage.getURL());
sectionPage.getForm().setFieldValue(By.name("XWiki.Registration_0_liveValidation_enabled"),
Boolean.valueOf(useLiveValidation()).toString());
sectionPage.clickSave();
if (x > 2) {
throw new WebDriverException("Unable to set useLiveValidation to " + useLiveValidation());
}
x++;
registerPage.gotoPage();