Example usage for org.openqa.selenium.interactions Actions moveToElement

List of usage examples for org.openqa.selenium.interactions Actions moveToElement

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions Actions moveToElement.

Prototype

public Actions moveToElement(WebElement target, int xOffset, int yOffset) 

Source Link

Document

Moves the mouse to an offset from the center of the element.

Usage

From source file:TenConcurrentUser.BFUIJobsExcnVldtnTest.java

License:Apache License

/**
 *  testStep2BFUIImagerySubmit() to accomplish testing 
 *  of below functions of BF UI:/* ww w  .j  a  v a2  s  .co  m*/
 *  a) After user successfully logs in to BF UI Application
 *  b) Selection of Create Job link
 *  c) On the Canvas, specifying the geographic area
 *  d) Entering the input data into the Search imagery request form.
 *  e) Submit the form successfully 
 *  
 * @throws Exception
 */
@Test
public void testStep2BFUIImagerySubmit() throws Exception {
    System.out.println(">>>> In BFUIJobsExcnVldtn.testStep2BFUIImagerySubmit() <<<<");

    driver.findElement(By.className("Navigation-linkCreateJob")).click();
    System.out.println(">> After requesting create job form");
    Thread.sleep(200);

    WebElement canvas = driver.findElement(By.cssSelector(".PrimaryMap-root canvas"));
    Thread.sleep(200); //To avoid any race condition

    Actions builder = new Actions(driver);
    builder.moveToElement(canvas, 900, 400).click().build().perform();
    canvas.click();
    Thread.sleep(1000); //To avoid any race condition

    builder.moveToElement(canvas, 400, 100).click().build().perform();
    canvas.click();
    Thread.sleep(200);

    System.out.println(">> After selecting bounding box as geographic search criteria area on canvas");
    Thread.sleep(5000); //To avoid any race condition

    // populating API key on the Imagery search form
    driver.findElement(By.cssSelector("input[type=\"password\"]")).clear();
    driver.findElement(By.cssSelector("input[type=\"password\"]")).sendKeys("27c9b43f20f84a75b831f91bbb8f3923");
    Thread.sleep(1000);
    // Changing From date field for Date of Capture imagery search criteria
    driver.findElement(By.cssSelector("input[type=\"text\"]")).clear();
    driver.findElement(By.cssSelector("input[type=\"text\"]")).sendKeys("2015-01-01");
    Thread.sleep(500); //To avoid any race condition
    new Select(driver.findElement(By.cssSelector("select"))).selectByVisibleText("LANDSAT 8 (via Planet)");
    Thread.sleep(500);
    // Submitting the search criteria
    driver.findElement(By.cssSelector("button[type=\"submit\"]")).click();
    System.out.println(">> After entering data and submitting Source Imagery search form");
    Thread.sleep(2000); //Pause before exiting this test

}

From source file:TenConcurrentUser.BFUIJobsExcnVldtnTest.java

License:Apache License

/**
 *  testStep3BFSIResponsePopup() to accomplish testing of below functions of BF UI:
 *  a) After user enter the search criteria for image search catalog and submits
 *  b) Move to the map canvas panel//from w  w  w.j  a va2 s .  c  om
 *  c) Select the response image jpg file to display the pop up
 *     with properties of the selected response image
 *  
 * @throws Exception
 */
@Test
public void testStep3BFSIResponsePopup(int cordArrayIndex) throws Exception {
    System.out.println(">>>> In BFUIJobsExcnVldtn.testStep3BFSIResponsePopup() <<<<");
    Actions builder = new Actions(driver);
    WebElement canvas = driver.findElement(By.cssSelector(".PrimaryMap-root canvas"));
    WebElement search = driver.findElement(By.className("PrimaryMap-search"));
    Thread.sleep(200); //To avoid any race condition
    builder.moveToElement(search, 0, 0).click().build().perform();
    //canvas.click(); // With or without jenkins build fails
    Thread.sleep(1000); //To avoid any race condition
    System.out.println("Focusing on " + cordCity[cordArrayIndex][0]);
    driver.findElement(By.name("coordinate")).sendKeys(cordCity[cordArrayIndex][1]);
    Thread.sleep(200); //To avoid any race condition
    driver.findElement(By.name("coordinate")).submit();
    builder.moveToElement(canvas).click().build().perform();
    System.out.println("After moving to canvas and selecting image jpg on canvas");

    //       //By clickLinkElem = By.xpath("//*[@title='LC81950572015002LGN00']");
    //By clickLinkElem = By.xpath("//*[@title='LC82040522016276LGN00']");
    //if (this.isElementPresent(clickLinkElem)) {
    // Ensuring the properties windows is displayed for the image selected
    // LANDSAT image id for selected image should be the title.
    // driver.findElement(By.xpath("//*[@title='LC82040522016276LGN00']"));
    //driver.findElement(By.xpath("//*[@title='LC81210602015204LGN00']"));
    //System.out.println("After validating properties popup is displayed for the response image selected");
    //}

    Thread.sleep(2000); //Pause before exiting this test
}