List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:com.qkn.automation.pages.LoginPage.java
public void validateForgotPasswordLink() throws Exception { WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.xpath(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click(); Thread.sleep(TestConstants.MINSLEEPTIME); wait.until(//from w w w .jav a 2 s . c o m ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("FORGOTMYID_LINK")))); //pageDriver.findElement(By.id("com.intuit.qm2014:id/forgetUserIdPassword_TV")).click(); pageDriver.findElement(By.xpath(pageprops.getProperty("FORGOTMYID_LINK"))).click(); Thread.sleep(TestConstants.NOMINALSLEEPTIME); /* String ActualUrl2= pageDriver.findElement(By.id("com.android.browser:id/url")).getText(); System.out.println(ActualUrl2); String ForgotPasswordUrl=pageprops.getProperty("FORGOT_PASSOWRD_URL"); Assert.assertEquals(ForgotPasswordUrl, ActualUrl2); Thread.sleep(3000); pageDriver.navigate().back(); Thread.sleep(3000);*/ pageDriver.navigate().back(); Thread.sleep(TestConstants.NOMINALSLEEPTIME); }
From source file:com.qkn.automation.pages.LoginPage.java
public void navigateBackToSignInPage() throws Exception { MintLogger.log(Level.INFO, "navigateBackToSignInPage"); WebDriverWait wait = new WebDriverWait(pageDriver, 120); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("LOGIN_BACKBTN")))); pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_BACKBTN"))).click(); }
From source file:com.qkn.automation.pages.LoginPage.java
public void navigateToSignup() throws Exception { WebDriverWait wait = new WebDriverWait(pageDriver, 120); wait.until(ExpectedConditions .visibilityOfElementLocated(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE")))); pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click(); }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithValidCredentialsForAndroidQKN2(String email, String password) throws Exception { try {/*from w ww .j a va2s . c o m*/ WebDriverWait wait = new WebDriverWait(pageDriver, 30); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNIN_BTN")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("SIGNINOK_BTN")))); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNINOK_BTN")); QuickenLogger.log(Level.INFO, "Login successfull with " + email + " as username and " + password + " as password"); Thread.sleep(TestConstants.MINSLEEPTIME); } //added catch (Exception e) { MintLogger.log(Level.INFO, "Unable to Sign in "); e.printStackTrace(); } }
From source file:com.softwareonpurpose.uinavigator.UiHost.java
License:Apache License
/** * @param locator A Selenium.By WebElement * @return boolean Indicates whether the WebElement described by the By locator was visible within a defined timeout period */// w w w . j av a2 s. co m boolean waitUntilVisible(By locator) { try { new WebDriverWait(getDriver(), getConfig().timeout) .until(ExpectedConditions.visibilityOfElementLocated(locator)); } catch (WebDriverException e) { getLogger().warn(String.format("WARNING: UiElement '%s' failed to be displayed within %d seconds", locator.toString(), getConfig().timeout)); return false; } return true; }
From source file:com.tascape.qa.th.webui.comm.WebBrowser.java
License:Apache License
public WebElement waitForElement(By by, int seconds) { LOG.debug("Wait for element {} to appear", by); WebDriverWait wait = new WebDriverWait(this, seconds); WebElement e = wait.until(ExpectedConditions.visibilityOfElementLocated(by)); Assert.assertNotNull("Cannot find element " + by, e); return e;/*from www . ja v a 2 s. c o m*/ }
From source file:com.technophobia.webdriver.substeps.impl.FormWebDriverSubStepImplementations.java
License:Open Source License
/** * Clear any text from the element, and enter text (to the current element) * /*from w w w . ja va2 s . co m*/ * @example ClearAndSendKeys "hello" * @section Forms * @param value * the value */ @Step("ClearAndSendKeys \"([^\"]*)\"") public void clearAndSendKeys(final String value) { logger.debug("About to clear the current element and send the keys " + value); waitUntil(ExpectedConditions.visibilityOfElementLocated( WebDriverSubstepsBy.ByCurrentWebElement(webDriverContext().getCurrentElement()))); webDriverContext().getCurrentElement().clear(); webDriverContext().getCurrentElement().sendKeys(value); }
From source file:com.vaadin.demo.testutil.AbstractDemoTest.java
License:Apache License
protected void waitForElementVisible(final By by) { waitUntil(ExpectedConditions.visibilityOfElementLocated(by)); }
From source file:com.vaadin.tests.components.grid.basicfeatures.server.LoadingIndicatorTest.java
License:Apache License
@Test public void testLoadingIndicator() throws InterruptedException { setDebug(true);/*from w ww . ja v a2 s . c om*/ openTestURL(); selectMenuPath("Component", "State", "Container delay", "2000"); GridElement gridElement = $(GridElement.class).first(); Assert.assertFalse("Loading indicator should not be visible before disabling waitForVaadin", isLoadingIndicatorVisible()); testBench().disableWaitForVaadin(); // Scroll to a completely new location gridElement.getCell(200, 1); // Wait for loading indicator delay waitUntil(ExpectedConditions.visibilityOfElementLocated(By.className("v-loading-indicator"))); waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By.className("v-loading-indicator"))); // Scroll so much that more data gets fetched, but not so much that // missing rows are shown gridElement.getCell(230, 1); // Wait for potentially triggered loading indicator to become visible Thread.sleep(500); Assert.assertFalse("Loading indicator should not be visible when fetching rows that are not visible", isLoadingIndicatorVisible()); // Finally verify that there was actually a request going on waitUntilLogContains("Requested items"); }
From source file:com.vaadin.tests.integration.WebSpherePortalIntegrationTest.java
License:Apache License
private void waitUntilPortletIsLoaded() { WebDriverWait wait = new WebDriverWait(driver, 15); wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("v-app"))); }