Search in sources :

Example 66 with WebElement

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

the class BlackBoxBase method createEducation.

public static void createEducation(String institutionName) {
    String institutionNameXpath = "//input[@ng-model='editAffiliation.affiliationName.value']";
    BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(institutionNameXpath)), webDriver);
    BBBUtil.ngAwareSendKeys(institutionName, "affiliationName", webDriver);
    String cityXpath = "//input[@ng-model='editAffiliation.city.value']";
    BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(cityXpath)), webDriver);
    BBBUtil.ngAwareSendKeys("Test land", "city", webDriver);
    String countryXpath = "//select[@ng-model='editAffiliation.country.value']";
    BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(countryXpath)), webDriver);
    WebElement countryInput = findElement(By.xpath(countryXpath));
    Select input = new Select(countryInput);
    input.selectByValue(Iso3166Country.US.value());
    BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
    ((JavascriptExecutor) webDriver).executeScript("$('#save-affiliation').click();");
    BBBUtil.noCboxOverlay(webDriver);
    BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
}
Also used : JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement)

Example 67 with WebElement

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

the class BlackBoxBase method createAddress.

public static void createAddress(String countryCode) {
    By addNew = By.xpath("//a[@ng-click='addNewModal()']/span");
    waitForElementVisibility(addNew);
    waitForAngular();
    ngAwareClick(findElement(addNew));
    waitForAngular();
    By emptyInput = By.xpath("(//select[@ng-model='country.iso2Country.value'])[last()]//option[@value = " + Quotes.escape(countryCode) + "]");
    waitForElementVisibility(emptyInput);
    WebElement countryElement = findElement(emptyInput);
    BBBUtil.ngAwareClick(countryElement, webDriver);
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 68 with WebElement

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

the class BlackBoxBase method changeAddressVisibility.

public static void changeAddressVisibility(Visibility visibility) {
    int index = getPrivacyIndex(visibility);
    String countriesVisibilityXpath = "//div[@ng-repeat='country in countryForm.addresses']//descendant::div[@id='privacy-bar']/ul/li[" + index + "]/a";
    BBBUtil.extremeWaitFor(ExpectedConditions.elementToBeClickable(By.xpath(countriesVisibilityXpath)), webDriver);
    List<WebElement> visibilityElements = webDriver.findElements(By.xpath(countriesVisibilityXpath));
    for (WebElement webElement : visibilityElements) {
        BBBUtil.ngAwareClick(webElement, webDriver);
    }
}
Also used : WebElement(org.openqa.selenium.WebElement)

Example 69 with WebElement

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

the class BlackBoxBase method adminUnlockAccount.

public void adminUnlockAccount(String adminUserName, String adminPassword, String orcidToUnlock) {
    // Login Admin
    adminSignIn(adminUserName, adminPassword);
    try {
        // Unlock 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='unlockProfileDiv']/p[1]/a[2]")));
        BBBUtil.ngAwareClick(webDriver.findElement(By.xpath("//div[@id='unlockProfileDiv']/p[1]/a[2]")), webDriver);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        WebElement unLockProfileOrcidId = webDriver.findElement(By.id("orcid_to_unlock"));
        unLockProfileOrcidId.sendKeys(orcidToUnlock);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.visibilityOfElementLocated(By.id("bottom-confirm-unlock-profile")));
        BBBUtil.ngAwareClick(webDriver.findElement(By.id("bottom-confirm-unlock-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-unlock")));
        BBBUtil.ngAwareClick(webDriver.findElement(By.id("btn-unlock")), webDriver);
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS)).until(BBBUtil.angularHasFinishedProcessing());
    } catch (TimeoutException t) {
    //Account might be already unlocked
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement) TimeoutException(org.openqa.selenium.TimeoutException)

Example 70 with WebElement

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

the class BlackBoxBase method deleteEducation.

public static void deleteEducation(String institutionName) {
    By byInstitutionName = By.xpath("//span[@ng-bind-html='group.getActive().affiliationName.value' and text()='" + institutionName + "']");
    BBBUtil.extremeWaitFor(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@id='workspace-publications' and @orcid-loaded='true']")), webDriver);
    List<WebElement> wList = webDriver.findElements(By.xpath("//*[@education-put-code and descendant::span[text() = '" + institutionName + "']]"));
    if (wList.size() > 0)
        for (WebElement we : wList) {
            String putCode = we.getAttribute("education-put-code");
            putCode = "" + putCode;
            String deleteJsStr = "angular.element(document.body).injector().get('affiliationsSrvc').deleteAffiliation({'putCode': {'value': '" + putCode + "'},'affiliationType': {'value': 'education'}});";
            ((JavascriptExecutor) webDriver).executeScript(deleteJsStr);
            BBBUtil.extremeWaitFor(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@id='workspace-publications' and @orcid-loaded='true']")), webDriver);
        }
    BBBUtil.extremeWaitFor(ExpectedConditions.not(ExpectedConditions.presenceOfAllElementsLocatedBy(byInstitutionName)), webDriver);
    assertTrue(0 == webDriver.findElements(byInstitutionName).size());
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Aggregations

WebElement (org.openqa.selenium.WebElement)520 Test (org.junit.Test)96 WebDriver (org.openqa.selenium.WebDriver)85 PublicAtsApi (com.axway.ats.common.PublicAtsApi)57 Actions (org.openqa.selenium.interactions.Actions)55 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)46 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)40 By (org.openqa.selenium.By)36 URL (java.net.URL)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)34 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)30 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)21 NoSuchElementException (org.openqa.selenium.NoSuchElementException)21 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)19 ArrayList (java.util.ArrayList)18 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)13 Select (org.openqa.selenium.support.ui.Select)13 TimeoutException (org.openqa.selenium.TimeoutException)12 VisualEditorPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.visualeditor.VisualEditorPageObject)11 List (java.util.List)10