use of org.openqa.selenium.WebDriver in project ghostdriver by detro.
the class MouseCommandsTest method doubleClick.
@Test
public void doubleClick() {
WebDriver d = getDriver();
Actions actionBuilder = new Actions(d);
d.get("http://www.duckduckgo.com");
// Double click
actionBuilder.doubleClick().build().perform();
// Double click on the logo
actionBuilder.doubleClick(d.findElement(By.id("logo_homepage_link"))).build().perform();
}
use of org.openqa.selenium.WebDriver in project ghostdriver by detro.
the class MouseCommandsTest method clickAndHold.
@Test
public void clickAndHold() {
WebDriver d = getDriver();
Actions actionBuilder = new Actions(d);
d.get("http://www.duckduckgo.com");
// Hold, then release
actionBuilder.clickAndHold().build().perform();
actionBuilder.release();
// Hold on the logo, then release
actionBuilder.clickAndHold(d.findElement(By.id("logo_homepage_link"))).build().perform();
actionBuilder.release();
}
use of org.openqa.selenium.WebDriver in project ghostdriver by detro.
the class NavigationTest method navigateToGoogleAdwords.
@Test
public void navigateToGoogleAdwords() {
WebDriver d = getDriver();
d.get("http://adwords.google.com");
assertTrue(d.getCurrentUrl().contains("google.com"));
}
use of org.openqa.selenium.WebDriver in project ghostdriver by detro.
the class ElementMethodsTest method shouldNotHandleCasesWhenAsyncJavascriptInitiatesAPageLoadFarInTheFuture.
@Test
public void shouldNotHandleCasesWhenAsyncJavascriptInitiatesAPageLoadFarInTheFuture() {
server.setHttpHandler("GET", new HttpRequestCallback() {
@Override
public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
res.getOutputStream().println("<script type=\"text/javascript\">\n" + " function myFunction() {\n" + " setTimeout(function() {\n" + " window.location.href = 'http://www.google.com';\n" + " }, 5000);\n" + " }\n" + " </script>\n" + " <a onclick=\"javascript: myFunction();\">Click Here</a>");
}
});
WebDriver d = getDriver();
d.get(server.getBaseUrl());
// Initiate timer that will finish with loading Google in the window
d.findElement(By.xpath("html/body/a")).click();
// "google.com" hasn't loaded yet at this stage
assertFalse(d.getTitle().toLowerCase().contains("google"));
}
use of org.openqa.selenium.WebDriver 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());
}
Aggregations