Search in sources :

Example 71 with WebElement

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

the class BlackBoxBase method addEmail.

public static void addEmail(String emailValue, Visibility visibility) {
    String emailFormXpath = "//div[@ng-controller='EmailEditCtrl']//input[@type='email']";
    String saveButtonXpath = "//div[@ng-controller='EmailEditCtrl']//input[@type='email']/following-sibling::span[1]";
    BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(By.xpath(emailFormXpath)), webDriver);
    WebElement emailInputElement = webDriver.findElement(By.xpath(emailFormXpath));
    emailInputElement.sendKeys(emailValue);
    BBBUtil.ngAwareClick(webDriver.findElement(By.xpath(saveButtonXpath)), webDriver);
    updateEmailVisibility(emailValue, visibility);
}
Also used : WebElement(org.openqa.selenium.WebElement)

Example 72 with WebElement

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

the class BlackBoxBase method deleteFunding.

public static void deleteFunding(String fundingTitle) {
    By byFundingTitle = By.xpath("//span[@ng-bind='group.getActive().fundingTitle.title.value' and text()='" + fundingTitle + "']");
    BBBUtil.extremeWaitFor(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@id='workspace-publications' and @orcid-loaded='true']")), webDriver);
    List<WebElement> wList = webDriver.findElements(By.xpath("//*[@funding-put-code and descendant::span[text() = '" + fundingTitle + "']]"));
    if (wList.size() > 0)
        for (WebElement we : wList) {
            String putCode = we.getAttribute("funding-put-code");
            putCode = "" + putCode;
            String deleteJsStr = "angular.element(document.body).injector().get('fundingSrvc').deleteFunding('" + putCode + "');";
            ((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(byFundingTitle)), webDriver);
    assertTrue(0 == webDriver.findElements(byFundingTitle).size());
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 73 with WebElement

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

the class BlackBoxBase method deleteAddresses.

public static void deleteAddresses() {
    waitForAngular();
    By rowBy = By.xpath("//div[@ng-repeat='country in countryForm.addresses']");
    waitForElementVisibility(rowBy);
    List<WebElement> webElements = findElements(rowBy);
    for (WebElement webElement : webElements) {
        ngAwareClick(webElement.findElement(By.xpath("//div[@ng-click='deleteCountry(country)']")));
    }
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 74 with WebElement

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

the class BlackBoxBase method deleteExternalIdentifiers.

public static void deleteExternalIdentifiers() {
    waitForAngular();
    By rowBy = By.xpath("//div[@id='colorbox']//div[@ng-repeat='externalIdentifier in externalIdentifiersForm.externalIdentifiers']");
    waitForElementVisibility(rowBy);
    List<WebElement> webElements = findElements(rowBy);
    for (WebElement webElement : webElements) {
        ngAwareClick(webElement.findElement(By.xpath("//div[@ng-click='deleteExternalIdentifier(externalIdentifier)']")));
    }
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 75 with WebElement

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

the class BlackBoxBase method changeNamesVisibility.

public static void changeNamesVisibility(Visibility changeTo) throws Exception {
    int privacyIndex = getPrivacyIndex(changeTo);
    try {
        By openEditNames = By.xpath("//div[@id = 'names-section']//div[@id = 'open-edit-names']");
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(openEditNames));
        WebElement openEditNamesElement = webDriver.findElement(openEditNames);
        openEditNamesElement.click();
        By namesVisibility = By.xpath("//div[@id = 'names-section']//ul[@class='privacyToggle']/li[" + privacyIndex + "]/a");
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(namesVisibility));
        WebElement namesVisibilityElement = webDriver.findElement(namesVisibility);
        namesVisibilityElement.click();
        By saveButton = By.xpath("//div[@id = 'names-section']//ul[@class='workspace-section-toolbar']//li[1]//button");
        (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(saveButton));
        WebElement button = webDriver.findElement(saveButton);
        button.click();
        Thread.sleep(1000);
    } catch (Exception e) {
        System.out.println("Unable to find names-visibility-limited element");
        e.printStackTrace();
        throw e;
    }
}
Also used : By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement) TimeoutException(org.openqa.selenium.TimeoutException) JSONException(org.codehaus.jettison.json.JSONException)

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