use of org.openqa.selenium.htmlunit.HtmlUnitWebElement in project ats-framework by Axway.
the class HiddenHtmlTextBox method appendValue.
/**
* Append text to the current content of a Text Box
*
* @param value
*/
@PublicAtsApi
public void appendValue(String value) {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement element = HiddenHtmlElementLocator.findElement(this);
element.sendKeys(value);
UiEngineUtilities.sleep();
}
use of org.openqa.selenium.htmlunit.HtmlUnitWebElement in project ats-framework by Axway.
the class HiddenHtmlMultiSelectList method setValue.
/**
* select a value
*
* @param value the value to select
*/
@Override
@PublicAtsApi
public void setValue(String value) {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
if (selectElement.getAttribute("multiple") == null) {
throw new SeleniumOperationException("Not a multi-select. You may only add a selection to a select that supports multiple selections. (" + this.toString() + ")");
}
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 org.openqa.selenium.htmlunit.HtmlUnitWebElement 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 org.openqa.selenium.htmlunit.HtmlUnitWebElement 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 org.openqa.selenium.htmlunit.HtmlUnitWebElement in project ats-framework by Axway.
the class HiddenHtmlCheckBox method unCheck.
/**
* Uncheck the check box
*/
@Override
@PublicAtsApi
public void unCheck() {
new HiddenHtmlElementState(this).waitToBecomeExisting();
HtmlUnitWebElement element = HiddenHtmlElementLocator.findElement(this);
if (!element.isEnabled()) {
throw new UnsupportedOperationException("You may not uncheck a disabled element." + toString());
}
if (element.isSelected()) {
element.click();
}
UiEngineUtilities.sleep();
}
Aggregations