List of usage examples for org.openqa.selenium.support.ui Wait until
<T> T until(Function<? super F, T> isTrue);
From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java
public void openThirdPartyPage() { totalResultMessage += "Open Third Party Connections page\n"; driver.findElement(setUpButtonLocator).click(); driver.findElement(thirdPartyButtonLocator).click(); final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable) .withMessage("'Third Party' page was not loaded"); wait.until(ExpectedConditions.elementToBeClickable(authorizeLoginFieldLocator)); ProgressBar.addProgressValue(progressVariable); }
From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java
public void configureUPSAccount(String userName, String password, String licenseNumber, String shipperNumber) { totalResultMessage += "Select Carrier Getaway Tab\n"; driver.findElement(carrierGetawayTabLocator).click(); totalResultMessage += "Set UPS credentials:\n"; totalResultMessage += " - Click UPS checkbox\n"; ProgressBar.addProgressValue(progressVariable); String upsIsChecked = driver.findElement(upsConfigurationCheckboxLocator).getAttribute("checked"); if (!Objects.equals(upsIsChecked, "true")) { driver.findElement(upsConfigurationCheckboxLocator).click(); totalResultMessage += "UPS checkbox was not selected\n"; } else {// www. jav a 2 s . c om totalResultMessage += "UPS checkbox was selected\n"; } ProgressBar.addProgressValue(progressVariable); final Wait<WebDriver> wait3 = new WebDriverWait(driver, timeoutVariable) .withMessage("'UPS User Name' field was not found"); WebElement element2 = wait3.until(ExpectedConditions.elementToBeClickable(upsUserNameFieldLocator)); Assert.assertEquals(element2.isDisplayed(), true, "'UPS User Name' field was not loaded"); totalResultMessage += " - Enter UPS username\n"; WebElement userNameField = driver.findElement(upsUserNameFieldLocator); userNameField.clear(); userNameField.sendKeys(userName); ProgressBar.addProgressValue(progressVariable); totalResultMessage += " - Enter UPS password\n"; WebElement passwordField = driver.findElement(upsPasswordFieldLocator); passwordField.clear(); passwordField.sendKeys(password); ProgressBar.addProgressValue(progressVariable); totalResultMessage += " - Enter UPS License Number\n"; WebElement licenseNumberField = driver.findElement(upsLicenseNumberFieldLocator); licenseNumberField.clear(); licenseNumberField.sendKeys(licenseNumber); ProgressBar.addProgressValue(progressVariable); totalResultMessage += " - Enter UPS Shipper Number\n"; WebElement shipperNumberField = driver.findElement(upsShipperNumberFieldLocator); shipperNumberField.clear(); shipperNumberField.sendKeys(shipperNumber); ProgressBar.addProgressValue(progressVariable); // Test for UPS connection // log("Make Test for UPS"); // driver.findElement(upsTestButtonLocator).click(); // final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable).withMessage("UPS test result popup was not found"); // wait.until(ExpectedConditions.visibilityOfElementLocated(testResultPopupLocator)); // // String currentPopupMessage = driver.findElement(testResultPopupLocator).getText(); // Assert.assertEquals(currentPopupMessage, "The connection test was successful.", "UPS test result unexpected popup message."); // // driver.findElement(confirmPopupButtonLocator).click(); }
From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java
public void configureUSPSAccount(String accountId, String passPhrase) { totalResultMessage += "Click USPS checkbox\n"; final Wait<WebDriver> wait2 = new WebDriverWait(driver, timeoutVariable) .withMessage("USPS checkbox is not clickable"); wait2.until(ExpectedConditions.elementToBeClickable(uspsConfigurationCheckboxLocator)); totalResultMessage += "Click USPS checkbox\n"; String uspsIsChecked;/* w w w . j a v a2 s . c o m*/ uspsIsChecked = driver.findElement(uspsConfigurationCheckboxLocator).getAttribute("checked"); ProgressBar.addProgressValue(progressVariable); if (!Objects.equals(uspsIsChecked, "true")) { driver.findElement(uspsConfigurationCheckboxLocator).click(); totalResultMessage += "USPS checkbox was not selected\n"; } else { totalResultMessage += "USPS checkbox was selected\n"; } ProgressBar.addProgressValue(progressVariable); final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable) .withMessage("'USPS Account ID' field was not found"); WebElement element = wait.until(ExpectedConditions.elementToBeClickable(uspsAccountIdFieldLocator)); Assert.assertEquals(element.isDisplayed(), true, "'USPS Account ID' field was not loaded"); totalResultMessage += " - Enter USPS Account ID\n"; WebElement accountIdField = driver.findElement(uspsAccountIdFieldLocator); accountIdField.clear(); accountIdField.sendKeys(accountId); ProgressBar.addProgressValue(progressVariable); totalResultMessage += " - Enter USPS Pass Phrase\n"; WebElement passPhraseField = driver.findElement(uspsPasswordFieldLocator); passPhraseField.clear(); passPhraseField.sendKeys(passPhrase); ProgressBar.addProgressValue(progressVariable); // log("Make Test for USPS"); // driver.findElement(uspsTestButtonLocator).click(); // final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable).withMessage("USPS test result popup was not found"); // wait.until(ExpectedConditions.visibilityOfElementLocated(testResultPopupLocator)); // // String currentPopupMessage = driver.findElement(testResultPopupLocator).getText(); // Assert.assertEquals(currentPopupMessage, "The connection test was successful.", "USPS test result unexpected popup message"); // Thread.sleep(5000); // // driver.findElement(confirmPopupButtonLocator).click(); // Thread.sleep(5000); }
From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java
public void saveThirdPartyConnectionSettings() { totalResultMessage += "Click 'Save and Close' button\n"; driver.findElement(saveAndCloseContextualButtonLocator).click(); final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable) .withMessage("Confirmation popup was not found"); wait.until(ExpectedConditions.visibilityOfElementLocated(testResultPopupLocator)); ProgressBar.addProgressValue(3);/*from ww w . ja va2 s .co m*/ totalResultMessage += "Confirm popup message\n"; driver.findElement(popupOkBtnLocator).click(); ProgressBar.addProgressValue(3); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public WebElement findChildElement(WebElement element, final By by) { Wait<WebElement> wait = new FluentWait<WebElement>(element).withTimeout(DRIVER_WAIT_TIME, TimeUnit.SECONDS) .ignoring(ElementNotVisibleException.class).ignoring(NoSuchElementException.class); return wait.until(new Function<WebElement, WebElement>() { @Override//from www . j av a2 s. c o m public WebElement apply(WebElement webElement) { return webElement.findElement(by); } }); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public List<WebElement> waitForElementsVisible(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(by)); return getDriver().findElements(by); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public List<WebElement> waitForElementsClickable(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.elementToBeClickable(by)); return getDriver().findElements(by); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public WebElement waitForExpectedElement(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.visibilityOfElementLocated(by)); return getDriver().findElement(by); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public void waitForElementInvisible(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.invisibilityOfElementLocated(by)); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public List<WebElement> waitForExpectedElements(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(by)); return getDriver().findElements(by); }