public String text(SeleniumQueryObject seleniumQueryObject) { return TextFunction.text(seleniumQueryObject); }
public String html(SeleniumQueryObject seleniumQueryObject) { return HtmlFunction.html(seleniumQueryObject); }
private static String html(WebElement element) { if (isHtmlUnitDriver(element)) { return getHtmlForHtmlUnitDriver(element); } return element.getAttribute("innerHTML"); }
@Test public void text() { // given List<WebElement> els = asList(new WebElementText("AAA"), new WebElementText("BBB"), new WebElementText("CCC")); // when String text = TextFunction.text(els); // then assertEquals("AAA BBB CCC", text); }
private static String getHtmlForHtmlUnitDriver(WebElement element) { String html = getHtmlUnitInnerHTML((HtmlUnitWebElement) element); // #Cross-Driver // HtmlUnitDriver does not append a "\n" to the HTML of the body tag // as Chrome, Firefox and IE10 seem to. // So we add it! if ("body".equals(element.getTagName())) { return html + "\n"; } return html; }
@Test public void evaluates__success() { // given SeleniumQueryObject sqo = createStubSeleniumQueryObjectWithElements(new TextFunctionTest.WebElementText("aaa"), new TextFunctionTest.WebElementText("bbb")); // when EvaluationReport evaluate = matchesPredicateEvaluator.evaluate(sqo, lambda); // then assertTrue(evaluate.isSatisfiesConstraints()); }
public String text(SeleniumQueryObject seleniumQueryObject) { return TextFunction.text(seleniumQueryObject); }
private static String html(WebElement element) { if (isHtmlUnitDriver(element)) { return getHtmlForHtmlUnitDriver(element); } return element.getAttribute("innerHTML"); }
public String html(SeleniumQueryObject seleniumQueryObject) { return HtmlFunction.html(seleniumQueryObject); }
private static String getHtmlForHtmlUnitDriver(WebElement element) { String html = getHtmlUnitInnerHTML((HtmlUnitWebElement) element); // #Cross-Driver // HtmlUnitDriver does not append a "\n" to the HTML of the body tag // as Chrome, Firefox and IE10 seem to. // So we add it! if ("body".equals(element.getTagName())) { return html + "\n"; } return html; }
@Test public void evaluates__fail() { // given SeleniumQueryObject sqo = createStubSeleniumQueryObjectWithElements(new TextFunctionTest.WebElementText("zzz"), new TextFunctionTest.WebElementText("bbb")); // when EvaluationReport evaluate = matchesPredicateEvaluator.evaluate(sqo, lambda); // then assertFalse(evaluate.isSatisfiesConstraints()); }
public static String text(SeleniumQueryObject seleniumQueryObject) { return text(seleniumQueryObject.get()); }
/** * Returns the HTML of the first element of the list. * @param elements The list of elements. * @return The HTML of the first element. */ public static String html(List<WebElement> elements) { if (elements.isEmpty()) { return null; } return html(elements.get(0)); }
@Test public void evaluates__success() { // given SeleniumQueryObject elements = createStubSeleniumQueryObjectWithElements(new TextFunctionTest.WebElementText("aaa"), new TextFunctionTest.WebElementText("bbb")); // when EvaluationReport evaluate = matchesPatternEvaluator.evaluate(elements, caseInsensitivePattern); // then assertTrue(evaluate.isSatisfiesConstraints()); }
public static String text(SeleniumQueryObject seleniumQueryObject) { return text(seleniumQueryObject.get()); }
/** * Returns the HTML of the first element of the list. * @param elements The list of elements. * @return The HTML of the first element. */ public static String html(List<WebElement> elements) { if (elements.isEmpty()) { return null; } return html(elements.get(0)); }
@Test public void evaluates__fails() { // given SeleniumQueryObject elements = createStubSeleniumQueryObjectWithElements(new TextFunctionTest.WebElementText("zzz"), new TextFunctionTest.WebElementText("bbb")); // when EvaluationReport evaluate = matchesStringRegexEvaluator.evaluate(elements, "a{3} b{3}"); // then assertFalse(evaluate.isSatisfiesConstraints()); }
public static String html(SeleniumQueryObject seleniumQueryObject) { return html(seleniumQueryObject.get()); }
@Test public void evaluates__fail() { // given SeleniumQueryObject elements = createStubSeleniumQueryObjectWithElements(new TextFunctionTest.WebElementText("zzz"), new TextFunctionTest.WebElementText("bbb")); // when EvaluationReport evaluate = matchesPatternEvaluator.evaluate(elements, caseInsensitivePattern); // then assertFalse(evaluate.isSatisfiesConstraints()); }
public static String html(SeleniumQueryObject seleniumQueryObject) { return html(seleniumQueryObject.get()); }