Search in sources :

Example 41 with WebElement

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

the class GetAttributes 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("Name of the button is: " + searchButton.getAttribute("name"));
    System.out.println("Id of the button is: " + searchButton.getAttribute("id"));
    System.out.println("Class of the button is: " + searchButton.getAttribute("class"));
    System.out.println("Label of the button is: " + searchButton.getAttribute("aria-  label"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 42 with WebElement

use of org.openqa.selenium.WebElement 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 43 with WebElement

use of org.openqa.selenium.WebElement 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 44 with WebElement

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

the class GitblitDashboardView method login.

public void login(String id, String pw) {
    String pathID = LOGIN_AREA_SELECTOR + "/input[@name = \"username\" ]";
    String pathPW = LOGIN_AREA_SELECTOR + "/input[@name = \"password\" ]";
    String pathSubmit = LOGIN_AREA_SELECTOR + "/button[@type = \"submit\" ]";
    // System.out.println("DRIVER:"+getDriver());
    // List<WebElement> findElement =
    // getDriver().findElements(By.xpath("//span[@class = \"form-search\" ]"));
    //
    // System.out.println("ELEM: "+findElement);
    // System.out.println("SIZE: "+findElement.size());
    // System.out.println("XPath: "+pathID);
    WebElement idField = getDriver().findElement(By.xpath(pathID));
    // System.out.println("IDFIELD:"+idField);
    idField.sendKeys(id);
    WebElement pwField = getDriver().findElement(By.xpath(pathPW));
    // System.out.println(pwField);
    pwField.sendKeys(pw);
    WebElement submit = getDriver().findElement(By.xpath(pathSubmit));
    submit.click();
}
Also used : WebElement(org.openqa.selenium.WebElement)

Example 45 with WebElement

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

the class GitblitPageView method getElementWithFocus.

public WebElement getElementWithFocus() {
    String elScript = "return document.activeElement;";
    WebElement focuseedEl = (WebElement) ((JavascriptExecutor) getDriver()).executeScript(elScript);
    return focuseedEl;
}
Also used : 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