Example usage for org.openqa.selenium.support.ui ExpectedConditions frameToBeAvailableAndSwitchToIt

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions frameToBeAvailableAndSwitchToIt

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions frameToBeAvailableAndSwitchToIt.

Prototype

public static ExpectedCondition<WebDriver> frameToBeAvailableAndSwitchToIt(final WebElement frameLocator) 

Source Link

Document

An expectation for checking whether the given frame is available to switch to.

Usage

From source file:com.atanas.kanchev.testframework.selenium.handlers.NavigateSelenium.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w w.  j a va 2s  .  com*/
 */
@Override
public INavigateSelenium waitForFrameByIdToBeAvailableAndSwitch(String frameId) {
    try {
        new WebDriverWait(driver, 5).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frameId));

    } catch (NoSuchFrameException nsfe) {
        logger.error("Unable to Switch Frame - No Such Frame");

    }
    return this;
}

From source file:com.atanas.kanchev.testframework.selenium.handlers.Wait.java

License:Apache License

/**
 * {@inheritDoc}/* w  w w  .java  2  s  .  co  m*/
 */
@Override
public boolean isFrameAvailable(By locator, long wait) {
    try {
        getWait(wait).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator));
        return true;
    } catch (NoSuchFrameException e) {
        logger.error("No frame found located by " + locator.toString());
        throw new NoSuchFrameException(e.getMessage());
    }
}

From source file:com.cengage.mindtap.keywords.BasePageActions.java

public void switchToFrame(String stf) {
    WebDriverWait wait = new WebDriverWait(driver, 120);
    wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(stf));
}

From source file:com.cognifide.qa.bb.scope.frame.type.AemContentFrame.java

License:Apache License

/**
 * Switches to cq-cf-frame, if the address of the page contains "/cf#".
 *//*from  ww  w. ja  v  a2 s . c  o m*/
@Override
public void switchTo(WebDriver webDriver, BobcatWait bobcatWait) {
    if (webDriver.getCurrentUrl().contains(CF_URL_PART)) {
        LOG.debug("switching to AEM content frame..");
        bobcatWait.withTimeout(Timeouts.MEDIUM)
                .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(AEM_CF_FRAME));
        LOG.debug("..switched");
    } else {
        LOG.info("current URL does not contain '{}' fragment", CF_URL_PART);
    }
}

From source file:com.cognifide.qa.bb.scope.frame.type.NamedFrame.java

License:Apache License

@Override
public void switchTo(WebDriver webDriver, BobcatWait bobcatWait) {
    LOG.debug("Switching to " + name);
    bobcatWait.withTimeout(Timeouts.SMALL).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(name));
}

From source file:com.hotwire.test.steps.bex.BexAbstractModel.java

License:Open Source License

public void switchToFrame(String frameName) {
    LOGGER.info("Try to switch into the frame {}", frameName);
    new WebDriverWait(getWebdriverInstance(), MAX_WAIT)
            .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frameName));
    LOGGER.info("Switch is done..");
}

From source file:com.ppcxy.cyfm.showcase.functional.account.UserManagerFT.java

License:Apache License

@Test
@Category(Smoke.class)
public void list() {
    s.open("/manage");
    loginAsAdminIfNecessary();//from w  w  w. ja  v a2s .c  om
    s.getDriver().switchTo().frame("leftFrame");
    s.click(By.linkText("?"));

    s.getDriver().switchTo().defaultContent();

    s.waitForCondition(ExpectedConditions.frameToBeAvailableAndSwitchToIt("rightFrame"), 20000);

    WebElement table = s.findElement(By.id("contentTable"));
    assertThat(s.getTable(table, 5, 2)).isEqualTo("? ");
}

From source file:com.ppcxy.cyfm.showcase.functional.account.UserManagerFT.java

License:Apache License

@Test
@Category(Smoke.class)
public void editUser() {
    s.open("/manage");
    loginAsAdminIfNecessary();//from w  w w  . j a va 2 s  .c om
    s.getDriver().switchTo().frame("leftFrame");
    s.click(By.linkText("?"));

    s.getDriver().switchTo().defaultContent();

    s.waitForCondition(ExpectedConditions.frameToBeAvailableAndSwitchToIt("rightFrame"),
            Selenium2.DEFAULT_WAIT_TIME);
    s.click(By.id("editLink-user"));

    // ??
    s.type(By.name("name"), "user_foo");
    s.check(By.id("status2"));
    s.click(By.id("submit_btn"));

    // ??, ?
    s.click(By.id("editLink-user"));
    assertThat(s.getValue(By.name("name"))).isEqualTo("user_foo");
    assertThat(s.isChecked(By.id("status2"))).isTrue();

    // ??
    s.type(By.name("name"), "user");
    s.check(By.id("status1"));
    s.click(By.id("submit_btn"));
}

From source file:com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions.java

License:Apache License

public void switchToFrameWithExpectedConditionsById() {
    new WebDriverWait(driver, 5).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("myIFrame")));
}

From source file:com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions.java

License:Apache License

public void switchToFrameWithExpectedConditionsByName() {
    new WebDriverWait(driver, 5).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("myIFrame"));
}