Search in sources :

Example 6 with FluentWebDriver

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

the class AngularAndWebDriverTest method basic_actions.

/*
	  Ported from protractor/spec/basic/action_spec.js
	 */
@Test(enabled = true)
public void basic_actions() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/form");
    ngWebDriver.waitForAngularRequestsToFinish();
    FluentWebElement sliderBar = fwd.input(By.name("points"));
    sliderBar.getAttribute("value").shouldBe("1");
    new Actions(driver).dragAndDropBy(sliderBar.getWebElement(), 400, 20).build().perform();
    sliderBar.getAttribute("value").shouldBe("10");
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) Actions(org.openqa.selenium.interactions.Actions) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Test(org.testng.annotations.Test)

Example 7 with FluentWebDriver

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

the class AngularAndWebDriverTest method basic_elements_should_allow_using_repeater_locator_within_map.

/*
	  Ported from protractor/spec/basic/elements_spec.js
	  TODO - many more specs in here
	 */
@SuppressWarnings("serial")
@Test(enabled = false)
public void basic_elements_should_allow_using_repeater_locator_within_map() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/repeater");
    Map<String, String> expected = new HashMap<String, String>() {

        {
            put("M", "Monday");
            put("T", "Tuesday");
            put("W", "Wednesday");
            put("Th", "Thursday");
            put("F", "Friday");
        }
    };
    Map<String, String> days = fwd.lis(ByAngular.repeater("allinfo in days")).map(new FluentWebElementMap<String, String>() {

        public void map(FluentWebElement elem, int ix) {
            put(elem.element(ByAngular.binding("allinfo.initial")).getText().toString(), elem.element(ByAngular.binding("allinfo.name")).getText().toString());
        }
    });
    assertThat(days.entrySet(), equalTo(expected.entrySet()));
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) HashMap(java.util.HashMap) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.testng.annotations.Test)

Example 8 with FluentWebDriver

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

the class UrlEditorWebDriverTest method sharedForAllTests.

@BeforeClass
public static void sharedForAllTests() {
    // Keep the WebDriver browser window open between tests
    ChromeOptions co = new ChromeOptions();
    boolean headless = Boolean.parseBoolean(System.getProperty("HEADLESS", "false"));
    if (headless) {
        co.addArguments("headless");
    }
    co.addArguments("window-size=1200x800");
    DRIVER = new ChromeDriver(co);
    FWD = new FluentWebDriver(DRIVER);
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) ChromeOptions(org.openqa.selenium.chrome.ChromeOptions) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) BeforeClass(org.junit.BeforeClass)

Example 9 with FluentWebDriver

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

the class RadiatorWebDriverTest method sharedForAllTests.

@BeforeClass
public static void sharedForAllTests() {
    // Keep the WebDriver browser window open between tests
    DRIVER = new ChromeDriver();
    FWD = new FluentWebDriver(DRIVER);
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

Example 10 with FluentWebDriver

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

the class RadiatorWebDriverTest method sharedForAllTests.

@BeforeClass
public static void sharedForAllTests() {
    // Keep the WebDriver browser window open between tests
    ChromeOptions co = new ChromeOptions();
    boolean headless = Boolean.parseBoolean(System.getProperty("HEADLESS", "false"));
    if (headless) {
        co.addArguments("headless");
    }
    co.addArguments("window-size=1200x800");
    DRIVER = new ChromeDriver(co);
    FWD = new FluentWebDriver(DRIVER);
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) ChromeOptions(org.openqa.selenium.chrome.ChromeOptions) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

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