use of org.openqa.selenium.WebElement in project gitblit by gitblit.
the class RepoListView method checkOrDoDeleteRepo.
private boolean checkOrDoDeleteRepo(String fullyQualifiedRepoPathAndName, boolean doDelete) {
List<WebElement> found = getDriver().findElements(By.partialLinkText("delete"));
String onclickIdentifier = getDeleteRepoOnclickIdentifier(fullyQualifiedRepoPathAndName);
WebElement result = null;
for (WebElement webElement : found) {
if (webElement.getAttribute("onclick") != null && webElement.getAttribute("onclick").equals(onclickIdentifier)) {
result = webElement;
break;
}
}
System.out.println("result ? " + result);
if (result == null) {
return false;
}
if (doDelete) {
System.out.println(".............. DO DELETE .... ");
result.click();
}
return true;
}
use of org.openqa.selenium.WebElement in project mastering-java by Kingminghuang.
the class SogouSearch method testSearch.
public void testSearch(String url, String elementId, String searchContent) throws InterruptedException {
driver.get(url);
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
WebElement searchElem = driver.findElement(By.id(elementId));
searchElem.clear();
searchElem.sendKeys(searchContent);
searchElem.sendKeys(Keys.RETURN);
Thread.sleep(5000);
driver.quit();
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class BlackBoxBase method updatePersonalNamesVisibility.
public void updatePersonalNamesVisibility(Visibility visibility) {
By elementLocation = By.xpath(String.format("//div[@id='names-section']//div[@id='privacy-bar']/ul/li[%s]/a", getPrivacyIndex(visibility)));
waitForElementVisibility(elementLocation);
WebElement privacyOption = findElement(elementLocation);
ngAwareClick(privacyOption);
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class BlackBoxBase method changeDefaultUserVisibility.
public static void changeDefaultUserVisibility(WebDriver webDriver, Visibility visibility, boolean logUserOut) {
String baseUri = BBBUtil.getProperty("org.orcid.web.baseUri");
String userOrcid = BBBUtil.getProperty("org.orcid.web.testUser1.username");
String userPassword = BBBUtil.getProperty("org.orcid.web.testUser1.password");
if (PojoUtil.isEmpty(baseUri)) {
baseUri = "https://localhost:8443/orcid-web";
}
if (logUserOut) {
BBBUtil.logUserOut(baseUri, webDriver);
webDriver.get(baseUri + "/account");
SigninTest.signIn(webDriver, userOrcid, userPassword);
BBBUtil.noSpinners(webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
} else {
webDriver.get(baseUri + "/account");
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
}
By privacyPreferenceToggle = By.id("privacyPreferencesToggle");
BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(privacyPreferenceToggle), webDriver);
WebElement toggle = webDriver.findElement(privacyPreferenceToggle);
BBBUtil.ngAwareClick(toggle, webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
String clickXPathStr = "//div[@id='privacy-settings' and contains(text(),'By default, who should')]//a[contains(@ng-click,'" + visibility.value().toUpperCase() + "')]";
String clickWorkedStr = "//div[@id='privacy-settings' and contains(text(),'By default, who should ')]//li[@class='" + visibility.value().toLowerCase() + "Active']//a[contains(@ng-click,'" + visibility.value().toUpperCase() + "')]";
BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(ByXPath.xpath(clickXPathStr)), webDriver);
BBBUtil.ngAwareClick(webDriver.findElement(ByXPath.xpath(clickXPathStr)), webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
BBBUtil.extremeWaitFor(ExpectedConditions.visibilityOfElementLocated(ByXPath.xpath(clickWorkedStr)), webDriver);
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class BlackBoxBase method updateExternalIdentifierVisibility.
public static void updateExternalIdentifierVisibility(String extId, Visibility visibility) {
By elementLocation = By.xpath(String.format("//div[@ng-repeat='externalIdentifier in externalIdentifiersForm.externalIdentifiers'][descendant::a[contains(text(),'%s')]]//div[@id='privacy-bar']/ul/li[%s]/a", extId, getPrivacyIndex(visibility)));
waitForElementVisibility(elementLocation);
WebElement privacyOption = findElement(elementLocation);
ngAwareClick(privacyOption);
}
Aggregations