Search in sources :

Example 81 with Actions

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

the class Action method mouseOverAndClick.

// Method to mouse hover to an element and click
public void mouseOverAndClick(Supplier<By> from, Supplier<By> to) {
    Actions action = new Actions(driver());
    action.moveToElement(driver.findElement(from.get())).moveToElement(driver.findElement(to.get())).click().build().perform();
}
Also used : Actions(org.openqa.selenium.interactions.Actions)

Example 82 with Actions

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

the class Action method dragDropClickMoveRelease.

//drag and drop function using clickAndHold, moveToElement & release with Lint Text
public Actions dragDropClickMoveRelease(Supplier<By> from, Supplier<By> to) {
    Actions build = new Actions(driver);
    build.clickAndHold(driver.findElement(from.get())).build().perform();
    build.moveToElement(driver.findElement(to.get())).build().perform();
    build.release(driver.findElement(to.get())).perform();
    return build;
}
Also used : Actions(org.openqa.selenium.interactions.Actions)

Example 83 with Actions

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

the class ActionBuildPerform2 method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/selectable.html");
    WebElement one = driver.findElement(By.name("one"));
    WebElement three = driver.findElement(By.name("three"));
    WebElement five = driver.findElement(By.name("five"));
    // Add all the actions into the Actions builder.
    Actions builder = new Actions(driver);
    builder.keyDown(Keys.CONTROL).click(one).click(three).click(five).keyUp(Keys.CONTROL);
    // Perform the action.
    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 84 with Actions

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

the class ClickAndHoldAndRelease method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/Sortable.html");
    WebElement three = driver.findElement(By.name("three"));
    Actions builder = new Actions(driver);
    // Move tile3 to the position of tile2
    builder.clickAndHold(three).moveByOffset(120, 0).release().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 85 with Actions

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

the class ClickAndHoldAndReleaseOnWebElement method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/Sortable.html");
    WebElement three = driver.findElement(By.name("three"));
    WebElement two = driver.findElement(By.name("two"));
    Actions builder = new Actions(driver);
    // Move tile3 to the position of tile2
    builder.clickAndHold(three).release(two).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)

Aggregations

Actions (org.openqa.selenium.interactions.Actions)116 WebElement (org.openqa.selenium.WebElement)72 WebDriver (org.openqa.selenium.WebDriver)26 Test (org.junit.Test)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)18 PublicAtsApi (com.axway.ats.common.PublicAtsApi)16 Action (org.openqa.selenium.interactions.Action)10 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)9 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)6 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)4 List (java.util.List)3 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)2 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)2 MobileElementState (com.axway.ats.uiengine.utilities.mobile.MobileElementState)2 AndroidDriver (io.appium.java_client.android.AndroidDriver)2 File (java.io.File)2 DecimalFormat (java.text.DecimalFormat)2 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)2 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 VerticalLayoutElement (com.vaadin.testbench.elements.VerticalLayoutElement)1