use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class HiddenHtmlMultiSelectList method getValues.
/**
* @return the selected value
*/
@Override
@PublicAtsApi
public String[] getValues() {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
List<String> values = new ArrayList<String>();
List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
for (WebElement element : optionElements) {
if (element.isSelected()) {
values.add(element.getText());
}
}
if (values.isEmpty()) {
throw new SeleniumOperationException("There is no selected 'option' in " + this.toString());
}
return values.toArray(new String[0]);
}
use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class HiddenHtmlMultiSelectList method unsetValue.
/**
* unselect a value
*
* @param value the value to unselect
*/
@Override
@PublicAtsApi
public void unsetValue(String value) {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
for (WebElement el : optionElements) {
if (el.getText().equals(value)) {
if (el.isSelected()) {
((HtmlUnitWebElement) el).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 AbstractHtmlEngine method switchToWindowByTitle.
private void switchToWindowByTitle(final String windowTitle, long timeoutInSeconds) {
ExpectedCondition<Boolean> expectation = new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
return switchToWindowByTitle(windowTitle);
}
};
Wait<WebDriver> wait = new WebDriverWait(webDriver, timeoutInSeconds);
try {
wait.until(expectation);
} catch (Exception e) {
throw new SeleniumOperationException("Timeout waiting for Window with title '" + windowTitle + "' to appear.", e);
}
}
use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class HiddenHtmlSingleSelectList method getAllPossibleValues.
/**
* @return a list with all possible selection values
*/
@Override
@PublicAtsApi
public List<String> getAllPossibleValues() {
List<String> values = new ArrayList<String>();
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
if (optionElements.size() > 0) {
for (WebElement element : optionElements) {
values.add(element.getText());
}
return values;
}
throw new SeleniumOperationException("There is no selectable 'option' in " + this.toString());
}
use of com.axway.ats.uiengine.exceptions.SeleniumOperationException in project ats-framework by Axway.
the class HiddenHtmlSingleSelectList method getValue.
/**
* @return the single selection value
*/
@Override
@PublicAtsApi
public String getValue() {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
for (WebElement element : optionElements) {
if (element.isSelected()) {
return element.getText();
}
}
throw new SeleniumOperationException("There is no selected 'option' in " + this.toString());
}
Aggregations