/** * switch focus of WebDriver to the next found window handle (that's your * newly opened window) */ public void switchToNewWindow() { handledWindowList.add(driver.getWindowHandle()); Sleeper.sleepTightInSeconds(3); for (final String winHandle : driver.getWindowHandles()) if (!handledWindowList.contains(winHandle)) { driver.switchTo().window(winHandle); break; } }
/** * @return */ public void waitLoadingPage() { if (loadProgressBy != null) waitUntilElementIsHidden(loadProgressBy); if (waitNotificationToHide && notifyBy != null) waitUntilElementIsHidden(notifyBy); Sleeper.sleepTightInSeconds(1); }
@Override public UpdateStatusPanel updateStatus(String status) { Preconditions.checkNotNull(status, "Status parameter is null"); updateStatusTextArea.clear(); updateStatusTextArea.sendKeys(status); postButton.click(); int wait = 0; while (wait++ <= WAIT_FOR_POST_UPDATE && postButton.isDisplayed()) { Sleeper.sleepTightInSeconds(5); } return this; }
/** * Allows TODO */ public void refresh() { driver.navigate().refresh(); Sleeper.sleepTightInSeconds(2); waitLoadingPage(); }
/** * Waits for a certain time * * @param seconds amount of time to wait in seconds * @throws Throwable */ @When("^wait for (\\d+) seconds$") public void waitForSomeSeconds(int seconds) throws Throwable { log.info("waiting " + seconds + " seconds"); Sleeper.sleepTightInSeconds(seconds); }
/** * Defines the sleeping time to apply for a scenario * * @param scenario */ @Before public void before(Scenario scenario) { Sleeper.sleepTightInSeconds(1); }