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);
}
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());
}
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)']")));
}
}
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)']")));
}
}
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;
}
}
Aggregations