use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class RealHtmlMultiSelectList method unsetValue.
/**
* unselect a value
*
* @param value the value to unselect
*/
@Override
@PublicAtsApi
public void unsetValue(String value) {
new RealHtmlElementState(this).waitToBecomeExisting();
WebElement element = RealHtmlElementLocator.findElement(this);
Select select = new Select(element);
// select.deselectByVisibleText( value ); // this method doesn't throw an exception if the option doesn't exist
for (WebElement option : select.getOptions()) {
if (option.getText().equals(value)) {
if (option.isSelected()) {
option.click();
UiEngineUtilities.sleep();
}
return;
}
}
throw new SeleniumOperationException("Option with label '" + value + "' not found. (" + this.toString() + ")");
}
use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class RealHtmlMultiSelectList method setValue.
/**
* select a value
*
* @param value the value to select
*/
@Override
@PublicAtsApi
public void setValue(String value) {
new RealHtmlElementState(this).waitToBecomeExisting();
try {
WebElement element = RealHtmlElementLocator.findElement(this);
Select select = new Select(element);
select.selectByVisibleText(value);
} catch (NoSuchElementException nsee) {
throw new SeleniumOperationException("Option with label '" + value + "' not found. (" + this.toString() + ")");
}
UiEngineUtilities.sleep();
}
Aggregations