Search in sources :

Example 1 with FluentWebElements

use of org.seleniumhq.selenium.fluent.FluentWebElements in project selenium_java by sergueik.

the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_many_rows_by_partial_match.

/*
	  Ported from protractor/spec/basic/locators_spec.js
	  TODO - many more specs in here
	 */
@Test(enabled = false)
public void basic_locators_by_repeater_should_find_many_rows_by_partial_match() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/repeater");
    FluentWebElements spans = fwd.spans(ByAngular.repeater("baz in days | filter:'T'").column("baz.initial"));
    spans.getText().shouldBe("TTh");
    spans.get(0).getText().shouldBe("T");
    spans.get(1).getText().shouldBe("Th");
    spans = fwd.spans(ByAngular.repeater("baz in days | fil").column("baz.initial"));
    spans.getText().shouldBe("TTh");
    spans.get(0).getText().shouldBe("T");
    spans.get(1).getText().shouldBe("Th");
    try {
        fwd.li(ByAngular.exactRepeater("baz in days | fil").column("baz.initial")).getText().shouldBe("TTh");
        fail("should have barfed");
    } catch (FluentExecutionStopped e) {
        assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.li(exactRepeater(baz in days | fil).column(baz.initial))"));
        assertThat(e.getCause().getMessage(), startsWith("exactRepeater(baz in days | fil).column(baz.initial) didn't have any matching elements at this place in the DOM"));
    }
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) FluentExecutionStopped(org.seleniumhq.selenium.fluent.FluentExecutionStopped) FluentWebElements(org.seleniumhq.selenium.fluent.FluentWebElements) Test(org.testng.annotations.Test)

Example 2 with FluentWebElements

use of org.seleniumhq.selenium.fluent.FluentWebElements in project BuildRadiator by BuildRadiator.

the class UrlEditorWebDriverTest method editorDisplayRemovesUnderScoresFromContrivedTitle.

@Test
public void editorDisplayRemovesUnderScoresFromContrivedTitle() {
    app = new TestVersionOfEditorApp();
    startAppAndOpenWebDriverOnEditorPage(CONTRIVED_PATH_FOR_TESTING + "#abcde12345/a_contrived_title/0/a_a/1/b_b/2/c_c");
    FWD.div().getText().within(secs(3)).shouldContain("a contrived title");
    FluentWebElements lis = FWD.lis();
    lis.get(0).getText().shouldContain("0:");
    lis.get(0).input().getAttribute("value").shouldContain("a a");
    lis.get(1).getText().shouldContain("1:");
    lis.get(1).input().getAttribute("value").shouldContain("b b");
    lis.get(2).getText().shouldContain("2:");
    lis.get(2).input().getAttribute("value").shouldContain("c c");
}
Also used : FluentWebElements(org.seleniumhq.selenium.fluent.FluentWebElements) Test(org.junit.Test)

Example 3 with FluentWebElements

use of org.seleniumhq.selenium.fluent.FluentWebElements in project selenium_java by sergueik.

the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_many_rows_by_partial_match2.

/*
	  Ported from protractor/spec/basic/locators_spec.js
	  TODO - many more specs in here
	 */
@Test(enabled = false)
public void basic_locators_by_repeater_should_find_many_rows_by_partial_match2() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/repeater");
    FluentWebElements lis = fwd.lis(ByAngular.repeater("baz in days | filter:'T'"));
    lis.getText().shouldBe("TTh");
    lis.get(0).getText().shouldBe("T");
    lis.get(1).getText().shouldBe("Th");
    lis = fwd.lis(ByAngular.repeater("baz in days | fil"));
    lis.getText().shouldBe("TTh");
    lis.get(0).getText().shouldBe("T");
    lis.get(1).getText().shouldBe("Th");
    try {
        fwd.lis(ByAngular.exactRepeater("baz in days | filt")).getText().shouldBe("T");
        fail("should have barfed");
    } catch (FluentExecutionStopped e) {
        assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.lis(exactRepeater(baz in days | filt))"));
        assertThat(e.getCause().getMessage(), startsWith("exactRepeater(baz in days | filt) didn't have any matching elements at this place in the DOM"));
    }
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) FluentExecutionStopped(org.seleniumhq.selenium.fluent.FluentExecutionStopped) FluentWebElements(org.seleniumhq.selenium.fluent.FluentWebElements) Test(org.testng.annotations.Test)

Aggregations

FluentWebElements (org.seleniumhq.selenium.fluent.FluentWebElements)3 FluentExecutionStopped (org.seleniumhq.selenium.fluent.FluentExecutionStopped)2 FluentWebDriver (org.seleniumhq.selenium.fluent.FluentWebDriver)2 Test (org.testng.annotations.Test)2 Test (org.junit.Test)1