Search in sources :

Example 6 with WebElement

use of org.openqa.selenium.WebElement in project ghostdriver by detro.

the class GoogleSearchTest method searchForCheese.

@Test
public void searchForCheese() {
    String strToSearchFor = "Cheese!";
    WebDriver d = getDriver();
    // Load Google.com
    d.get(" http://www.google.com");
    // Locate the Search field on the Google page
    WebElement element = d.findElement(By.name("q"));
    // Type Cheese
    element.sendKeys(strToSearchFor);
    // Submit form
    element.submit();
    // Check results contains the term we searched for
    assertTrue(d.getTitle().toLowerCase().contains(strToSearchFor.toLowerCase()));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 7 with WebElement

use of org.openqa.selenium.WebElement in project ghostdriver by detro.

the class ElementMethodsTest method checkEnabledOnGoogleSearchBox.

@Test
public void checkEnabledOnGoogleSearchBox() {
    // TODO: Find a sample site that has hidden elements and use it to
    // verify behavior of enabled and disabled elements.
    WebDriver d = getDriver();
    d.get("http://www.google.com");
    WebElement el = d.findElement(By.cssSelector("input[name*='q']"));
    assertTrue(el.isEnabled());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 8 with WebElement

use of org.openqa.selenium.WebElement in project ghostdriver by detro.

the class FileUploadTest method checkUploadingTheSameFileMultipleTimes.

@Test
public void checkUploadingTheSameFileMultipleTimes() throws IOException {
    WebDriver d = getDriver();
    File file = File.createTempFile("test", "txt");
    file.deleteOnExit();
    d.get(server.getBaseUrl() + "/common/formPage.html");
    WebElement uploadElement = d.findElement(By.id("upload"));
    uploadElement.sendKeys(file.getAbsolutePath());
    uploadElement.submit();
    d.get(server.getBaseUrl() + "/common/formPage.html");
    uploadElement = d.findElement(By.id("upload"));
    uploadElement.sendKeys(file.getAbsolutePath());
    uploadElement.submit();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 9 with WebElement

use of org.openqa.selenium.WebElement in project ghostdriver by detro.

the class ElementMethodsTest method checkClickOnAHREFCausesPageLoad.

@Test
public void checkClickOnAHREFCausesPageLoad() {
    WebDriver d = getDriver();
    d.get("http://www.google.com");
    WebElement link = d.findElement(By.cssSelector("a[href=\"/intl/en/ads/\"]"));
    link.click();
    assertTrue(d.getTitle().contains("Ads"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 10 with WebElement

use of org.openqa.selenium.WebElement in project ghostdriver by detro.

the class ElementMethodsTest method checkDisplayedOnGoogleSearchBox.

@Test
public void checkDisplayedOnGoogleSearchBox() {
    WebDriver d = getDriver();
    d.get("http://www.google.com");
    WebElement el = d.findElement(By.cssSelector("input[name*='q']"));
    assertTrue(el.isDisplayed());
    el = d.findElement(By.cssSelector("input[type='hidden']"));
    assertFalse(el.isDisplayed());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

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