/** * @param text Specify expected text * @return Wait while Element’s text contains expected text. Returns Element’s text */ public final String waitText(String text) { return invoker.doJActionResult(format("Wait text contains '%s'", text), () -> timer().getResultByCondition(this::getTextAction, t -> t.contains(text))); }
/** * @param regEx Specify expected regular expression Text * @return Wait while Element’s text matches regEx. Returns Element’s text */ public final String waitMatchText(String regEx) { return invoker.doJActionResult(format("Wait text match regex '%s'", regEx), () -> timer().getResultByCondition(this::getTextAction, t -> t.matches(regEx))); } }
/** * @param text Specify expected text * @return Wait while Element’s text contains expected text. Returns Element’s text */ public final String waitText(String text) { return invoker.doJActionResult(format("Wait text contains '%s'", text), () -> timer().getResultByCondition(this::getTextAction, t -> t.contains(text))); }
/** * @param regEx Specify expected regular expression Text * @return Wait while Element’s text matches regEx. Returns Element’s text */ public final String waitMatchText(String regEx) { return invoker.doJActionResult(format("Wait text match regex '%s'", regEx), () -> timer().getResultByCondition(this::getTextAction, t -> t.matches(regEx))); } }
/** * @param text Specify expected text * @return Wait while Element’s text contains expected text. Returns Element’s text */ public final String waitText(String text) { return invoker.doJActionResult(format("Wait text contains '%s'", text), () -> timer().getResultByCondition(this::getTextAction, t -> t.contains(text))); }
/** * @param regEx Specify expected regular expression Text * @return Wait while Element’s text matches regEx. Returns Element’s text */ public final String waitMatchText(String regEx) { return invoker.doJActionResult(format("Wait text match regex '%s'", regEx), () -> timer().getResultByCondition(this::getTextAction, t -> t.matches(regEx))); } }
private List<WebElement> getElementsByCondition(JFuncTREx<WebElement, Boolean> condition) { List<WebElement> elements = timer().getResultByCondition( this::searchElements, els -> any(els, getSearchCriteria())); if (elements == null || elements.size() == 0) return new ArrayList<>(); return elements.size() < 10 ? where(elements, condition) : elements; }
private List<WebElement> getElementsByCondition(JFuncTREx<WebElement, Boolean> condition) { List<WebElement> elements = timer().getResultByCondition( this::searchElements, els -> any(els, getSearchCriteria())); if (elements == null || elements.size() == 0) return new ArrayList<>(); return elements.size() < 10 ? where(elements, condition) : elements; }
private List<WebElement> getElementsByCondition(JFuncTREx<WebElement, Boolean> condition) { List<WebElement> elements = timer().getResultByCondition( this::searchElements, els -> any(els, getSearchCriteria())); if (elements == null || elements.size() == 0) return new ArrayList<>(); return elements.size() < 10 ? where(elements, condition) : elements; }
protected int getCount(boolean acceptEmpty) { setWaitTimeout(0); List<WebElement> elements = getHeadersAction(); if (elements.size() == 0) elements = getCrossFirstLine(); restoreWaitTimeout(); if (!acceptEmpty) elements = timer().getResultByCondition(this::getCrossFirstLine, el -> el != null && el.size() > 0); return elements != null && elements.size() > 0 ? elements.size() : 0; }
protected int getCount(boolean acceptEmpty) { setWaitTimeout(0); List<WebElement> elements = getHeadersAction(); if (elements.size() == 0) elements = getCrossFirstLine(); restoreWaitTimeout(); if (!acceptEmpty) elements = timer().getResultByCondition(this::getCrossFirstLine, el -> el != null && el.size() > 0); return elements != null && elements.size() > 0 ? elements.size() : 0; }
/** * @param resultFunc Specify expected function result * @param condition Specify expected function condition * @return Waits while condition with WebElement happens and returns result using resultFunc */ @Step public <R> R wait(Function<WebElement, R> resultFunc, Function<R, Boolean> condition) { return timer().getResultByCondition(() -> resultFunc.apply(getWebElement()), condition); }
/** * @param resultFunc Specify expected function result * @param condition Specify expected function condition * @return Waits while condition with WebElement happens and returns result using resultFunc */ @Step public <T> T wait(Function<WebElement, T> resultFunc, Function<T, Boolean> condition) { return timer().getResultByCondition(() -> resultFunc.apply(getWebElement()), condition::apply); }
/** * @param resultFunc Specify expected function result * @param condition Specify expected function condition * @return Waits while condition with WebElement happens and returns result using resultFunc */ @Step public <R> R wait(Function<WebElement, R> resultFunc, Function<R, Boolean> condition) { return timer().getResultByCondition(() -> resultFunc.apply(getWebElement()), condition); }
public WebElement getElement() { logger.debug("Get Web Element: " + element); WebElement element = webElement != null ? webElement : timer().getResultByCondition(this::getElementAction, el -> el != null); logger.debug("One Element found"); return element; }
/** * @param resultFunc Specify expected function result * @param timeoutSec Specify timeout * @param condition Specify expected function condition * @return Waits while condition with WebElement and returns wait result */ @Step public <T> T wait(Function<WebElement, T> resultFunc, Function<T, Boolean> condition, int timeoutSec) { setWaitTimeout(timeoutSec); T result = new Timer(timeoutSec * 1000).getResultByCondition(() -> resultFunc.apply(getWebElement()), condition::apply); restoreWaitTimeout(); return result; }
public final MapArray<String, ICell> getRow(String rowName) { try { int colsCount = table.columns().count(); List<String> headers = table.columns().headers(); List<WebElement> webRowLine = timer().getResultByCondition( () -> getLineAction(rowName), els -> els.size() == colsCount); return new MapArray<>(colsCount, headers::get, value -> table.cell(webRowLine.get(value), new Column(headers.get(value)), new Row(rowName))); } catch (Exception | Error ex) { throw throwRowsException(rowName, ex.getMessage()); } }
public final MapArray<String, ICell> getColumn(String colName) { try { int rowsCount = table.rows().count(); List<String> headers = select(table.rows().headers(), String::toLowerCase); List<WebElement> webColumn = timer().getResultByCondition( () -> getLineAction(colName), els -> els.size() == rowsCount); return new MapArray<>(rowsCount, headers::get, value -> table.cell(webColumn.get(value), new Column(colName), new Row(headers.get(value)))); } catch (Exception | Error ex) { throw throwColumnException(colName, ex.getMessage()); } }
public final MapArray<String, ICell> getColumn(String colName) { try { int rowsCount = table.rows().count(); List<String> headers = select(table.rows().headers(), String::toLowerCase); List<WebElement> webColumn = timer().getResultByCondition( () -> getLineAction(colName), els -> els.size() == rowsCount); return new MapArray<>(rowsCount, headers::get, value -> table.cell(webColumn.get(value), new Column(colName), new Row(headers.get(value)))); } catch (Exception | Error ex) { throw throwColumnException(colName, ex.getMessage()); } }
public final MapArray<String, ICell> getColumn(String colName) { try { int rowsCount = table.rows().count(); List<String> headers = table.rows().headers(); List<WebElement> webColumn = timer().getResultByCondition( () -> getLineAction(colName), els -> els.size() == rowsCount); return new MapArray<>(rowsCount, table.rows().headers()::get, value -> table.cell(webColumn.get(value), new Column(colName), new Row(headers.get(value)))); } catch (Exception | Error ex) { throw throwColumnException(colName, ex.getMessage()); } }