Search in sources :

Example 46 with WebDriver

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

the class DragAndDrop method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/DragAndDrop.html");
    WebElement src = driver.findElement(By.id("draggable"));
    WebElement trgt = driver.findElement(By.id("droppable"));
    Actions builder = new Actions(driver);
    builder.dragAndDrop(src, trgt).perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 47 with WebDriver

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

the class DragMe method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/DragMe.html");
    WebElement dragMe = driver.findElement(By.id("draggable"));
    Actions builder = new Actions(driver);
    builder.dragAndDropBy(dragMe, 300, 200).perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 48 with WebDriver

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

the class MoveByOffset method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/Selectable.html");
    WebElement three = driver.findElement(By.name("three"));
    System.out.println("X coordinate: " + three.getLocation().getX() + "  Y coordinate: " + three.getLocation().getY());
    Actions builder = new Actions(driver);
    builder.moveByOffset(three.getLocation().getX() + 1, three.getLocation().getY() + 1);
    builder.perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 49 with WebDriver

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

the class MoveByOffsetAndClick method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/Selectable.html");
    WebElement seven = driver.findElement(By.name("seven"));
    System.out.println("X coordinate: " + seven.getLocation().getX() + " Y coordinate: " + seven.getLocation().getY());
    Actions builder = new Actions(driver);
    builder.moveByOffset(seven.getLocation().getX() + 1, seven.getLocation().getY() + 1).click();
    builder.perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 50 with WebDriver

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

the class ByCSSSelector method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.cssSelector("#gbqfba"));
    System.out.println(searchButton.getText());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) 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