Search in sources :

Example 11 with TimeoutException

use of org.openqa.selenium.TimeoutException in project ORCID-Source by ORCID.

the class BlackBoxBase method adminLockAccount.

public void adminLockAccount(String adminUserName, String adminPassword, String orcidToLock) {
    adminSignIn(adminUserName, adminPassword);
    try {
        // Lock the account
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='lockProfileDiv']/p[1]/a[2]")));
        BBBUtil.ngAwareClick(webDriver.findElement(By.xpath("//div[@id='lockProfileDiv']/p[1]/a[2]")), webDriver);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(By.id("bottom-confirm-lock-profile")), webDriver);
        WebElement lockProfileOrcidId = webDriver.findElement(By.id("orcid_to_lock"));
        lockProfileOrcidId.sendKeys(orcidToLock);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(By.id("bottom-confirm-lock-profile")), webDriver);
        BBBUtil.ngAwareClick(webDriver.findElement(By.id("bottom-confirm-lock-profile")), webDriver);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.visibilityOfElementLocated(By.id("btn-lock")));
        BBBUtil.ngAwareClick(webDriver.findElement(By.id("btn-lock")), webDriver);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
    } catch (TimeoutException t) {
    // Account might be already locked
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement) TimeoutException(org.openqa.selenium.TimeoutException)

Aggregations

TimeoutException (org.openqa.selenium.TimeoutException)11 WebElement (org.openqa.selenium.WebElement)9 Test (org.junit.Test)5 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)5 WebDriver (org.openqa.selenium.WebDriver)3 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 IOException (java.io.IOException)1 By (org.openqa.selenium.By)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 StaleElementReferenceException (org.openqa.selenium.StaleElementReferenceException)1 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)1 FirefoxBinary (org.openqa.selenium.firefox.FirefoxBinary)1 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)1 SafariDriver (org.openqa.selenium.safari.SafariDriver)1 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)1