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)
package com.sdl.selenium.bootstrap.form;
import com.sdl.selenium.web.WebLocator;
import com.sdl.selenium.web.form.ICombo;
/**
* 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 WebLocator 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();
}
public boolean isDisabled() {
String cls = getAttributeClass();
return (cls != null && cls.contains("disabled")) || getAttribute("disabled") != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy