Search in sources :

Example 46 with WebElement

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;
}
Also used : WebElement(org.openqa.selenium.WebElement)

Example 47 with WebElement

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();
}
Also used : WebElement(org.openqa.selenium.WebElement)

Example 48 with WebElement

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);
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 49 with WebElement

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);
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 50 with WebElement

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);
}
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