List of usage examples for org.openqa.selenium.interactions Actions Actions
public Actions(WebDriver driver)
From source file:com.sebuilder.interpreter.steptype.MouseOverElement.java
License:Apache License
@Override public boolean run(TestRun ctx) { new Actions(ctx.driver()).moveToElement(ctx.locator("locator").find(ctx)).build().perform(); return true;//from www. j a v a 2s.co m }
From source file:com.sebuilder.interpreter.steptype.ReleaseElement.java
License:Apache License
@Override public boolean run(TestRun ctx) { new Actions(ctx.driver()).release(ctx.locator("locator").find(ctx)).build().perform(); return true;//from w ww . j a va 2s . c o m }
From source file:com.seleniumtests.it.driver.support.pages.DriverTestPage.java
License:Apache License
public DriverTestPage _sendKeysComposite() { new Actions(driver).moveToElement(textElement).sendKeys("composite").build().perform(); new Actions(driver).moveToElement(resetButton).click().build().perform(); return this; }
From source file:com.seleniumtests.it.driver.TestUiActions.java
License:Apache License
@Test(groups = { "it" }) public void testNewAction() { try {//from w w w . j a v a2s. co m new Actions(((CustomEventFiringWebDriver) driver).getWebDriver()) .moveToElement(driver.findElement(By.id("carre2"))).click().build().perform(); Assert.assertEquals("coucou", driver.findElement(By.id("text2")).getAttribute("value")); } finally { new Actions(driver).moveToElement(driver.findElement(By.id("button2"))).click().build().perform(); Assert.assertEquals("", driver.findElement(By.id("text2")).getAttribute("value")); } }
From source file:com.seleniumtests.it.driver.TestUiActions.java
License:Apache License
@Test(groups = { "it" }) public void testNewActionWithHtmlElement() throws Exception { try {//from www . j a v a2s .c o m new Actions(((CustomEventFiringWebDriver) driver).getWebDriver()) .moveToElement(DriverTestPage.redSquare).click().build().perform(); Assert.assertEquals("coucou", driver.findElement(By.id("text2")).getAttribute("value")); } finally { new Actions(driver).moveToElement(driver.findElement(By.id("button2"))).click().build().perform(); Assert.assertEquals("", driver.findElement(By.id("text2")).getAttribute("value")); } }
From source file:com.seleniumtests.it.driver.TestUiActions.java
License:Apache License
@Test(groups = { "it" }) public void testMoveClick() { try {/*from ww w . j a va2 s . co m*/ new Actions(driver).moveToElement(driver.findElement(By.id("carre2"))).click().build().perform(); Assert.assertEquals("coucou", driver.findElement(By.id("text2")).getAttribute("value")); } finally { new Actions(driver).moveToElement(driver.findElement(By.id("button2"))).click().build().perform(); Assert.assertEquals("", driver.findElement(By.id("text2")).getAttribute("value")); } }
From source file:com.seleniumtests.it.driver.TestUiActions.java
License:Apache License
@Test(groups = { "it" }) public void testSendKeys() { try {/*w ww . j a va 2 s . co m*/ new Actions(driver).moveToElement(driver.findElement(By.id("text2"))).click().sendKeys("youpi").build() .perform(); Assert.assertEquals("youpi", driver.findElement(By.id("text2")).getAttribute("value")); } finally { driver.findElement(By.id("button2")).click(); } }
From source file:com.seleniumtests.it.driver.TestUiActions.java
License:Apache License
@Test(groups = { "it" }) public void testSendKeysWithHtmlElement() throws Exception { try {//from w ww .j a v a2 s . c o m new Actions(driver).moveToElement(DriverTestPage.textElement).click().sendKeys("youpi2").build() .perform(); Assert.assertEquals("youpi2", DriverTestPage.textElement.getAttribute("value")); } finally { driver.findElement(By.id("button2")).click(); } }
From source file:com.seleniumtests.uipage.htmlelements.DatePickerElement.java
License:Apache License
/** * Clear text field but assumes element exists *//* w ww . jav a 2 s. co m*/ private void clearField() { if (element == null) { throw new ScenarioException("Element should not be null"); } BrowserType browser = WebUIDriver.getWebUIDriver(false).getConfig().getBrowser(); if (browser == BrowserType.INTERNET_EXPLORER) { new Actions(driver).doubleClick(element) .sendKeys(Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE) .sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE) .perform(); } else { super.clear(); } }
From source file:com.seleniumtests.uipage.htmlelements.HtmlElement.java
License:Apache License
/** * Click with CompositeActions/*from w ww . java2 s . c o m*/ */ @ReplayOnError public void clickAction() { findElement(true); try { new Actions(driver).click(element).perform(); } catch (InvalidElementStateException e) { logger.error(e); } }