Search in sources :

Example 1 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgDemoTest method setup.

@BeforeClass
public static void setup() throws IOException {
    seleniumDriver = CommonFunctions.getSeleniumDriver();
    int width = 700;
    int height = 550;
    seleniumDriver.manage().window().setSize(new Dimension(width, height));
    int implicitWait = 10;
    int flexibleWait = 5;
    long pollingInterval = 500;
    seleniumDriver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS).implicitlyWait(implicitWait, TimeUnit.SECONDS).setScriptTimeout(10, TimeUnit.SECONDS);
    wait = new WebDriverWait(seleniumDriver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(seleniumDriver);
    ngDriver = new NgWebDriver(seleniumDriver);
    CommonFunctions.setHighlightTimeout(1000);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Dimension(org.openqa.selenium.Dimension) BeforeClass(org.junit.BeforeClass)

Example 2 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgDragDropIntegrationTest method setup.

@BeforeClass
public static void setup() throws IOException {
    sb = new StringBuilder();
    isCIBuild = CommonFunctions.checkEnvironment();
    seleniumDriver = CommonFunctions.getSeleniumDriver();
    seleniumDriver.manage().window().setSize(new Dimension(width, height));
    seleniumDriver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS).implicitlyWait(implicitWait, TimeUnit.SECONDS).setScriptTimeout(10, TimeUnit.SECONDS);
    wait = new WebDriverWait(seleniumDriver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(seleniumDriver);
    ngDriver = new NgWebDriver(seleniumDriver);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Dimension(org.openqa.selenium.Dimension) BeforeClass(org.junit.BeforeClass)

Example 3 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgIgnoreSyncIntegrationTest method setup.

@BeforeClass
public static void setup() throws IOException {
    isCIBuild = CommonFunctions.checkEnvironment();
    seleniumDriver = CommonFunctions.getSeleniumDriver();
    seleniumDriver.manage().window().setSize(new Dimension(width, height));
    seleniumDriver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS).implicitlyWait(implicitWait, TimeUnit.SECONDS).setScriptTimeout(10, TimeUnit.SECONDS);
    wait = new WebDriverWait(seleniumDriver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(seleniumDriver);
    ngDriver = new NgWebDriver(seleniumDriver);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Dimension(org.openqa.selenium.Dimension) BeforeClass(org.junit.BeforeClass)

Example 4 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgLocalFileIntegrationTest method testHover.

// @Ignore
@Test
public void testHover() {
    getPageContent("ng_hover1.htm");
    // Hover over menu
    WebElement element = seleniumDriver.findElement(By.id("hover"));
    highlight(element);
    actions.moveToElement(element).build().perform();
    // Wait for the Angular 'hovering' property to get evaluated to true
    WebDriverWait wait2 = new WebDriverWait(seleniumDriver, 120);
    wait2.pollingEvery(50, TimeUnit.MILLISECONDS);
    wait2.until(new ExpectedCondition<Boolean>() {

        // NOTE: 'until' only prints "hovering: true" and never "hovering: false"
        @Override
        public Boolean apply(WebDriver d) {
            NgWebDriver ngD = new NgWebDriver(d);
            // org.openqa.selenium.WebDriverException: The WebDriver instance must
            // implement JavaScriptExecutor interface.
            NgWebElement ng_element = ngD.findElement(By.id("hover"));
            Object value = ng_element.evaluate("hovering");
            System.err.println("hovering: " + value.toString());
            return parseBoolean(value.toString());
        }
    });
    actions.moveByOffset(0, 300).build().perform();
    // Wait for the tooltip div to get visible
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
    }
    actions.moveToElement(element).build().perform();
    try {
        wait.until(ExpectedConditions.visibilityOf(seleniumDriver.findElement(By.cssSelector("div[ng-show='hovering']"))));
    } catch (NoSuchElementException e) {
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) NgWebElement(com.github.sergueik.jprotractor.NgWebElement) NgWebElement(com.github.sergueik.jprotractor.NgWebElement) WebElement(org.openqa.selenium.WebElement) Boolean.parseBoolean(java.lang.Boolean.parseBoolean) NoSuchElementException(org.openqa.selenium.NoSuchElementException) Test(org.junit.Test)

Example 5 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgScrollableIntegrationTest method setup.

@BeforeClass
public static void setup() throws IOException {
    isCIBuild = CommonFunctions.checkEnvironment();
    seleniumDriver = CommonFunctions.getSeleniumDriver();
    seleniumDriver.manage().window().setSize(new Dimension(width, height));
    seleniumDriver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS).implicitlyWait(implicitWait, TimeUnit.SECONDS).setScriptTimeout(10, TimeUnit.SECONDS);
    wait = new WebDriverWait(seleniumDriver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(seleniumDriver);
    ngDriver = new NgWebDriver(seleniumDriver);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Dimension(org.openqa.selenium.Dimension) BeforeClass(org.junit.BeforeClass)

Aggregations

NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)25 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)18 BeforeClass (org.junit.BeforeClass)16 Actions (org.openqa.selenium.interactions.Actions)16 Dimension (org.openqa.selenium.Dimension)15 File (java.io.File)6 Before (org.junit.Before)6 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)6 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)6 HashMap (java.util.HashMap)5 NgWebElement (com.github.sergueik.jprotractor.NgWebElement)2 Formatter (java.util.Formatter)2 Test (org.junit.Test)2 Boolean.parseBoolean (java.lang.Boolean.parseBoolean)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 NgScrollableTablePage (org.henrrich.jpagefactory.example.scrollabletable.NgScrollableTablePage)1 TodoListPage (org.henrrich.jpagefactory.example.todolist.TodoListPage)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 TimeoutException (org.openqa.selenium.TimeoutException)1 WebDriver (org.openqa.selenium.WebDriver)1