use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class HtmlElement method sendKeysAction.
/**
* Send keys through composite actions /!\ does not clear text before and no
* blur after
*
* @param keysToSend
*/
@ReplayOnError(waitAfterAction = true)
public void sendKeysAction(CharSequence... keysToSend) {
findElement(true);
new Actions(getDriver()).sendKeys(getRealElementNoSearch(), keysToSend).build().perform();
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class PictureElement method swipe.
@ReplayOnError(replayDelayMs = 1000, waitAfterAction = true)
public void swipe(int xMove, int yMove) {
findElement();
int xInit = detectedObjectRectangle.x + detectedObjectRectangle.width / 2;
int yInit = detectedObjectRectangle.y + detectedObjectRectangle.height / 2;
createTouchAction().press(PointOption.point(xInit, yInit)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(500))).moveTo(PointOption.point(xInit + xMove, yInit + yMove)).release().perform();
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class SelectList method getSelectedValues.
@ReplayOnError
public String[] getSelectedValues() {
List<WebElement> allSelectedOptions = getAllTheSelectedOptions();
List<String> valueList = new ArrayList<>();
for (WebElement option : allSelectedOptions) {
valueList.add(selectImplementation.getOptionValue(option));
}
String[] texts = new String[valueList.size()];
return valueList.toArray(texts);
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class Table method getCellFromContent.
/**
* Returns the cell from table, searching for its content by pattern
*
* Tip: returned element is a HtmlElement, but you must cast it to use its specific methods
*
* @param content pattern to search for
* @param column column where pattern should be searched
* @return
*/
@ReplayOnError
public WebElement getCellFromContent(final Pattern content, final int column) {
findTableElement();
if (rows != null && !rows.isEmpty()) {
for (WebElement row : rows) {
List<WebElement> cols = getRowCells(row);
if (cols.isEmpty()) {
throw new ScenarioException("There are no columns in this row");
}
WebElement cell = cols.get(column);
Matcher matcher = content.matcher(cell.getText());
if (matcher.matches()) {
return cell;
}
}
throw new ScenarioException(String.format("Pattern %s has not been found in table", content.pattern()));
} else {
throw new ScenarioException(ERROR_NO_ROWS);
}
}
Aggregations