Search in sources :

Example 11 with FluentWebDriver

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

the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_single_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_single_rows_by_partial_match() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/repeater");
    fwd.li(ByAngular.repeater("baz in days | filter:'T'")).getText().shouldBe("T");
    fwd.li(ByAngular.withRootSelector("[ng-app]").repeater("baz in days | filt")).getText().shouldBe("T");
    try {
        fwd.li(ByAngular.exactRepeater("baz in days | filt")).getText().shouldBe("T");
        fail("should have barfed");
    } catch (FluentExecutionStopped e) {
        assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.li(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) Test(org.testng.annotations.Test)

Example 12 with FluentWebDriver

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

the class AngularAndWebDriverTest method basic_elements_chained_call_should_wait_to_grab_the_WebElement_until_a_method_is_called.

/*
	  Ported from protractor/spec/basic/elements_spec.js
	  TODO - many more specs in here
	 */
@Test(enabled = false)
public void basic_elements_chained_call_should_wait_to_grab_the_WebElement_until_a_method_is_called() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/conflict");
    FluentWebElement reused = fwd.div(id("baz")).span(ByAngular.binding("item.reusedBinding"));
    reused.getText().shouldBe("Inner: inner");
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Test(org.testng.annotations.Test)

Example 13 with FluentWebDriver

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

the class AngularAndWebDriverTest method altRoot_find_elements.

/*
	  Ported from protractor/spec/altRoot/findelements_spec.js
	 */
@Test(enabled = false)
public void altRoot_find_elements() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/alt_root_index.html#/form");
    ngWebDriver.waitForAngularRequestsToFinish();
    fwd.span(ByAngular.binding("{{greeting}}")).getText().shouldBe("Hiya");
    fwd.div(id("outside-ng")).getText().shouldBe("{{1 + 2}}");
    fwd.div(id("inside-ng")).getText().shouldBe("3");
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) Test(org.testng.annotations.Test)

Example 14 with FluentWebDriver

use of org.seleniumhq.selenium.fluent.FluentWebDriver 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)

Example 15 with FluentWebDriver

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

the class AngularAndWebDriverTest method basic_elements_should_chain_with_index_correctly.

/*
	  Ported from protractor/spec/basic/elements_spec.js
	  TODO - many more specs in here
	 */
@Test(enabled = true)
public void basic_elements_should_chain_with_index_correctly() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html");
    fwd.inputs(By.cssSelector("#checkboxes input")).last(new IsIndex2Or3()).click();
    fwd.span(By.cssSelector("#letterlist")).getText().shouldBe("'x'");
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) Test(org.testng.annotations.Test)

Aggregations

FluentWebDriver (org.seleniumhq.selenium.fluent.FluentWebDriver)15 Test (org.testng.annotations.Test)12 FluentExecutionStopped (org.seleniumhq.selenium.fluent.FluentExecutionStopped)5 FluentWebElement (org.seleniumhq.selenium.fluent.FluentWebElement)4 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)3 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)2 FluentWebElements (org.seleniumhq.selenium.fluent.FluentWebElements)2 HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 BeforeClass (org.junit.BeforeClass)1 Actions (org.openqa.selenium.interactions.Actions)1