use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class PictureElement method doubleClickAt.
@ReplayOnError(replayDelayMs = 1000, waitAfterAction = true)
public void doubleClickAt(int xOffset, int yOffset) {
findElement();
Point intoElementPos = intoElement.getCoordinates().onPage();
int relativeX = detectedObjectRectangle.x + detectedObjectRectangle.width / 2 - intoElementPos.x;
int relativeY = detectedObjectRectangle.y + detectedObjectRectangle.height / 2 - intoElementPos.y;
moveAndDoubleClick(intoElement, relativeX + (int) (xOffset * pictureSizeRatio), relativeY + (int) (yOffset * pictureSizeRatio));
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class SelectList method getSelectedTexts.
@ReplayOnError
public String[] getSelectedTexts() {
List<WebElement> allSelectedOptions = getAllTheSelectedOptions();
List<String> textList = new ArrayList<>();
for (WebElement option : allSelectedOptions) {
textList.add(selectImplementation.getOptionText(option));
}
String[] texts = new String[textList.size()];
return textList.toArray(texts);
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class SelectList method deselectByCorrespondingText.
@ReplayOnError(waitAfterAction = true)
public void deselectByCorrespondingText(final String text) {
try {
findElement();
if (!isMultipleSelect()) {
throw new UnsupportedOperationException(ERROR_MULTI_SELECT);
}
double score = 0;
WebElement optionToSelect = null;
for (WebElement option : options) {
String source = option.getText().trim();
if (service.score(source, text) > score) {
score = service.score(source, text);
optionToSelect = option;
}
}
if (optionToSelect != null) {
selectImplementation.setDeselected(optionToSelect);
} else {
throw new NoSuchElementException("Cannot locate option with corresponding text " + text);
}
} finally {
selectImplementation.finalizeAction();
}
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class Table method getRowFromContent.
/**
* issue #306
* Returns the row from table, searching for its content by pattern. Then you can search for a specific cell using 'getRowCells(row);'
*
* 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 getRowFromContent(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 row;
}
}
throw new ScenarioException(String.format("Pattern %s has not been found in table", content.pattern()));
} else {
throw new ScenarioException(ERROR_NO_ROWS);
}
}
use of com.seleniumtests.uipage.ReplayOnError in project seleniumRobot by bhecquet.
the class UiElement method clickAt.
@ReplayOnError(waitAfterAction = true)
public void clickAt(int xOffset, int yOffset) {
Point relativePoint = findElementPosition(xOffset, yOffset);
CustomEventFiringWebDriver.leftClicOnDesktopAt(true, relativePoint.x, relativePoint.y, SeleniumTestsContextManager.getThreadContext().getRunMode(), SeleniumTestsContextManager.getThreadContext().getSeleniumGridConnector());
}
Aggregations