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()));
}
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());
}
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();
}
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"));
}
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());
}
Aggregations