com.sdl.selenium.web.form.Field Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Testy Show documentation
Show all versions of Testy Show documentation
Automated Acceptance Testing. Selenium and Selenium WebDriver test framework for web applications.
(optimized for dynamic html, ExtJS, Bootstrap, complex UI, simple web applications/sites)
package com.sdl.selenium.web.form;
import com.sdl.selenium.web.SearchType;
import com.sdl.selenium.web.WebLocator;
import org.slf4j.Logger;
import java.time.Duration;
public abstract class Field extends WebLocator implements IField {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(Field.class);
/**
* @param value value
* @param searchTypes accept only SearchType.EQUALS, SearchType.CONTAINS, SearchType.STARTS_WITH, SearchType.TRIM
* @return current element
*/
public T setPlaceholder(String value, SearchType... searchTypes) {
setAttribute("placeholder", value, searchTypes);
return (T) this;
}
public String getError() {
WebLocator error = new WebLocator(this).setRoot("/../../../../").setClasses("x-form-error-wrap");
return error.getText();
}
public boolean clickIcon(String icon) {
if (ready()) {
WebLocator iconLocator = getTriggerEl(this, icon);
iconLocator.setRender(Duration.ofMillis(500));
return iconLocator.click();
} else {
log.warn("clickIcon : field is not ready for use: " + this);
}
return false;
}
/**
* @return true is the element doesn't have attribute readonly
*/
public boolean isEditable() {
return !"true".equals(getAttribute("readonly"));
}
public boolean isEnabled() {
return !"true".equals(getAttribute("disabled"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy