List of usage examples for org.openqa.selenium WebDriver navigate
Navigation navigate();
From source file:com.babu.zadoqa.util.WaitTool.java
License:Open Source License
/** * Wait for an element to appear on the refreshed web-page. * And returns the first WebElement using the given method. */*from www . j a va 2 s .c om*/ * This method is to deal with dynamic pages. * * Some sites I (Mark) have tested have required a page refresh to add additional elements to the DOM. * Generally you (Chon) wouldn't need to do this in a typical AJAX scenario. * * @param WebDriver The driver object to use to perform this element search * @param locator selector to find the element * @param int The time in seconds to wait until returning a failure * * @return WebElement the first WebElement using the given method, or null(if the timeout is reached) * * @author Mark Collin */ public static WebElement waitForElementRefresh(WebDriver driver, final By by, int timeOutInSeconds) { WebElement element; try { driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); //nullify implicitlyWait() new WebDriverWait(driver, timeOutInSeconds) { }.until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driverObject) { driverObject.navigate().refresh(); //refresh the page **************** return isElementPresentAndDisplay(driverObject, by); } }); element = driver.findElement(by); driver.manage().timeouts().implicitlyWait(DEFAULT_WAIT_4_PAGE, TimeUnit.SECONDS); //reset implicitlyWait return element; //return the element } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:com.ceiwc.compugain.setup.TestBase.java
public void navigateTo(String surl, WebDriver driver) { driver.manage().deleteAllCookies(); driver.navigate().to(surl); }
From source file:com.ceiwc.compugain.setup.TestBase.java
public void navigateTo_DeleteCookie(String surl, WebDriver driver) { driver.manage().deleteAllCookies(); driver.navigate().to(surl); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.pages.AuthorPage.java
License:Apache License
private void retryLoad() { conditions.verify(new ExpectedCondition<Object>() { @Nullable/*from w ww . j a v a 2 s . c o m*/ @Override public Object apply(WebDriver driver) { LOG.debug("Retrying page open"); driver.navigate().refresh(); return isLoadedCondition(); } }, Timeouts.MEDIUM); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.list.ChildPageWindow.java
License:Apache License
public boolean containsPage(String title) { return webElementUtils.isConditionMet(new ExpectedCondition<Object>() { @Nullable/* w ww . j av a 2 s. c o m*/ @Override public Object apply(@Nullable WebDriver weDriver) { try { return childPages.stream().filter(t -> t.getTitle().equals(title)).findFirst().isPresent(); } catch (StaleElementReferenceException e) { weDriver.navigate().refresh(); return false; } } }, Timeouts.SMALL); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.SiteadminPage.java
License:Apache License
@Override public SiteadminActions waitForPageCount(int pageCount) { boolean conditionNotMet = !webElementUtils.isConditionMet(new ExpectedCondition<Object>() { @Nullable//from ww w. j a v a2 s. co m @Override public Object apply(@Nullable WebDriver webDriver) { try { return (pageCount == getChildPageWindow().getPageCount()); } catch (StaleElementReferenceException e) { webDriver.navigate().refresh(); return false; } } }, Timeouts.SMALL); if (conditionNotMet) { throw new IllegalStateException("Timeout when waiting for page count: " + pageCount); } return this; }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.SiteadminPage.java
License:Apache License
private void waitForExpectedStatus(final String title, ActivationStatus status) { wait.withTimeout(Timeouts.MEDIUM).until(new ExpectedCondition<Boolean>() { @Nullable/*from ww w.j av a 2 s . c o m*/ @Override public Boolean apply(@Nullable WebDriver webDriver) { webDriver.navigate().refresh(); ChildPageRow childPage = getChildPageWindow().getChildPageRow(title); PageActivationStatus pageActivationStatusCell = childPage.getPageActivationStatus(); ActivationStatus activationStatus = pageActivationStatusCell.getActivationStatus(); return activationStatus.equals(status); } }, Timeouts.SMALL); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.SiteadminPage.java
License:Apache License
private void retryLoad() { conditions.verify(new ExpectedCondition<Object>() { @Nullable//from w w w.ja v a 2 s . co m @Override public Object apply(WebDriver driver) { if (!isLoadedCondition()) { driver.navigate().refresh(); } return isLoadedCondition(); } }, Timeouts.MEDIUM); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem62.SiteadminPage.java
License:Apache License
private void waitForExpectedStatus(final String title, ActivationStatus status) { wait.withTimeout(Timeouts.MEDIUM).until(new ExpectedCondition<Boolean>() { @Nullable// w w w. j av a 2 s . c o m @Override public Boolean apply(@Nullable WebDriver webDriver) { webDriver.navigate().refresh(); ChildPageRow childPageRow = getChildPageWindow().getChildPageRow(title); PageActivationStatus pageActivationStatusCell = childPageRow.getPageActivationStatus(); ActivationStatus activationStatus = pageActivationStatusCell.getActivationStatus(); return activationStatus.equals(status); } }, Timeouts.MINIMAL); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem62.SiteadminPage.java
License:Apache License
private void retryLoad() { conditions.verify(new ExpectedCondition<Object>() { @Nullable/* w w w. j a va 2s . c o m*/ @Override public Object apply(WebDriver driver) { driver.navigate().refresh(); return isLoadedCondition(); } }, Timeouts.MEDIUM); }