Search in sources :

Example 21 with ReplayOnError

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();
}
Also used : Actions(org.openqa.selenium.interactions.Actions) PerformsTouchActions(io.appium.java_client.PerformsTouchActions) ReplayOnError(com.seleniumtests.uipage.ReplayOnError)

Example 22 with ReplayOnError

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();
}
Also used : Point(org.openqa.selenium.Point) ReplayOnError(com.seleniumtests.uipage.ReplayOnError)

Example 23 with ReplayOnError

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);
}
Also used : ArrayList(java.util.ArrayList) WebElement(org.openqa.selenium.WebElement) ReplayOnError(com.seleniumtests.uipage.ReplayOnError)

Example 24 with ReplayOnError

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);
    }
}
Also used : Matcher(java.util.regex.Matcher) WebElement(org.openqa.selenium.WebElement) ScenarioException(com.seleniumtests.customexception.ScenarioException) ReplayOnError(com.seleniumtests.uipage.ReplayOnError)

Aggregations

ReplayOnError (com.seleniumtests.uipage.ReplayOnError)24 Point (org.openqa.selenium.Point)11 WebElement (org.openqa.selenium.WebElement)7 PerformsTouchActions (io.appium.java_client.PerformsTouchActions)5 MobileElement (io.appium.java_client.MobileElement)4 ScenarioException (com.seleniumtests.customexception.ScenarioException)3 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)3 DriverConfig (com.seleniumtests.driver.DriverConfig)3 MultiTouchAction (io.appium.java_client.MultiTouchAction)3 ArrayList (java.util.ArrayList)3 Matcher (java.util.regex.Matcher)3 NoSuchElementException (org.openqa.selenium.NoSuchElementException)3 Actions (org.openqa.selenium.interactions.Actions)2 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)1 Clock (java.time.Clock)1 Instant (java.time.Instant)1 InvalidElementStateException (org.openqa.selenium.InvalidElementStateException)1 Rectangle (org.openqa.selenium.Rectangle)1 TimeoutException (org.openqa.selenium.TimeoutException)1