com.sdl.selenium.bootstrap.form.SelectPicker 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)
The newest version!
package com.sdl.selenium.bootstrap.form;
import com.sdl.selenium.web.WebLocator;
import com.sdl.selenium.web.form.Field;
import com.sdl.selenium.web.form.ICombo;
import java.util.List;
/**
* Used for finding element process (to generate xpath address)
* Example:
* {@code
*
*
*
*
*
* }
* In Java write this:
* {@code
* SelectPicker selectPicker = new SelectPicker().setLabel("Tech:");
* selectPicker.select("Manual");
* }
*/
public class SelectPicker extends Field implements ICombo {
public SelectPicker() {
setClassName("SelectPicker");
setBaseCls("dropdown-toggle");
setTag("button");
}
public SelectPicker(WebLocator container) {
this();
setContainer(container);
}
public SelectPicker(WebLocator container, String label) {
this(container);
setLabel(label);
}
@Override
public boolean select(String value) {
click();
doSelect(value);
return true;
}
protected void doSelect(String value) {
WebLocator group = new WebLocator().setClasses("btn-group", "open");
WebLocator select = new WebLocator(group).setText(value).setInfoMessage("select: '" + value + "'");
select.click();
}
@Override
public String getValue() {
return getText().trim();
}
@Override
public List getAllValues() {
return null;
}
@Override
public boolean expand() {
return false;
}
@Override
public boolean collapse() {
return false;
}
public boolean isDisabled() {
String cls = getAttributeClass();
return (cls != null && cls.contains("disabled")) || getAttribute("disabled") != null;
}
public boolean isEnabled() {
String cls = getAttributeClass();
return (cls != null && !cls.contains("disabled")) || getAttribute("disabled") == null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy