Search in sources :

Example 56 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class GetCSSValue method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.name("btnK"));
    System.out.println(searchButton.getCssValue("font-family"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 57 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class GetSize method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.name("btnK"));
    System.out.println(searchButton.getSize());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 58 with WebDriver

use of org.openqa.selenium.WebDriver in project gitblit by gitblit.

the class GitblitDashboardView method waitToLoadFor.

public synchronized void waitToLoadFor(int sec) {
    WebDriverWait webDriverWait = new WebDriverWait(getDriver(), sec);
    webDriverWait.until(new ExpectedCondition<Boolean>() {

        public Boolean apply(WebDriver d) {
            return d.getTitle().toLowerCase().startsWith(GitblitDashboardView.TITLE_STARTS_WITH);
        }
    });
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 59 with WebDriver

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

the class PublicClientTest method testAuthenticateIsTheOnlyScopeThatWorksForPublicClient.

@Test
public void testAuthenticateIsTheOnlyScopeThatWorksForPublicClient() throws JSONException, InterruptedException {
    String clientId = getPublicClientId();
    String clientRedirectUri = getPublicClientRedirectUri();
    String userId = getUser1OrcidId();
    String password = getUser1Password();
    WebDriver webDriver = getWebDriver();
    for (ScopePathType scope : ScopePathType.values()) {
        if (ScopePathType.AUTHENTICATE.equals(scope)) {
            String authCode = getAuthorizationCode(clientId, clientRedirectUri, scope.value(), userId, password, true);
            assertFalse(PojoUtil.isEmpty(authCode));
        } else {
            String authorizationPageUrl = String.format(OauthAuthorizationPageHelper.authorizationScreenUrl, getWebBaseUrl(), clientId, scope.value(), clientRedirectUri);
            webDriver.get(authorizationPageUrl);
            String authCodeUrl = webDriver.getCurrentUrl();
            assertFalse(PojoUtil.isEmpty(authCodeUrl));
            assertTrue(authCodeUrl.contains("error=invalid_scope"));
        }
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) ScopePathType(org.orcid.jaxb.model.message.ScopePathType) Test(org.junit.Test)

Example 60 with WebDriver

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

the class OauthAuthorizationPageHelper method clickAuthorizeOnAuthorizeScreen.

private static void clickAuthorizeOnAuthorizeScreen(final WebDriver webDriver) {
    By userIdElementLocator = By.id("authorize");
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(userIdElementLocator));
    WebElement authorizeButton = webDriver.findElement(By.id("authorize"));
    authorizeButton.click();
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(new ExpectedCondition<Boolean>() {

        public Boolean apply(WebDriver d) {
            return d.getTitle().equals("ORCID Playground");
        }
    });
}
Also used : WebDriver(org.openqa.selenium.WebDriver) By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Aggregations

WebDriver (org.openqa.selenium.WebDriver)167 WebElement (org.openqa.selenium.WebElement)87 Test (org.junit.Test)61 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)59 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)40 Actions (org.openqa.selenium.interactions.Actions)25 IOException (java.io.IOException)12 Cookie (org.openqa.selenium.Cookie)11 List (java.util.List)10 File (java.io.File)9 HttpRequestCallback (ghostdriver.server.HttpRequestCallback)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)8 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)7 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)7 By (org.openqa.selenium.By)5 Dimension (org.openqa.selenium.Dimension)5 Predicate (com.google.common.base.Predicate)4 TimeoutException (org.openqa.selenium.TimeoutException)4