Scrolling and SendKeys with Pause/Keys.TAB- Actions

* Scroll to element and click on element

  • */
  • WebElement buttom = driver.findElement(By.cssSelector("#trigger-pro"));
  • //act.sendKeys(Keys.CONTROL).sendKeys(Keys.END);
  • act.scrollToElement(buttom).click(buttom).build().perform();
  • }

Scroll to bottom/top of page :

act.sendKeys(Keys.CONTROL).sendKeys(Keys.END).perform();

act.sendKeys(Keys.CONTROL).sendKeys(Keys.HOME).perform();


SendKeys with Pause :


searchText = driver.findElement(By.name("search"));

String textData = "sudheerReddy";

Actions act = new Actions(driver);

char[] aa = textData.toCharArray();

for(char bb :aa) {

System.out.println(bb);

act.sendKeys(searchText, String.valueOf(bb)).build().perform();

}


SendKeys with TAB/Pause



WebElement firstName = driver.findElement(By.name("firstname"));

Actions act = new Actions(driver);

act.sendKeys(firstName, ("Sudheer"))

.sendKeys(Keys.TAB)

.pause(500)

.sendKeys("chittireddy")

.pause(500)

.sendKeys(Keys.TAB)

.sendKeys("sud9eer@gmail.cok")

.pause(500)

.sendKeys(Keys.TAB)

.sendKeys("7778885641")

.pause(500)

.sendKeys(Keys.TAB)

.sendKeys("123456")

.pause(500)

.sendKeys(Keys.TAB)

.sendKeys("123456")

.build().perform();



Signature in canvas




driver.get("https://signature-generator.com/draw-signature/");

WebElement canvas= driver.findElement(By.id("signature-pad"));

/*

* target element to move to.

•xOffset Offset from the element's in-view center point. A negative value means an offsetleft of the point.

•yOffset Offset from the element's in-view center point. A negative value means an offsetabove the point


*/

Actions act = new Actions(driver);

act.click(canvas).moveToElement(canvas, 10, -100)

.clickAndHold(canvas)

.moveByOffset(30, 10)

.moveByOffset(15, 45).build().perform();

Comments

Popular posts from this blog

Implicit and Explicit Waits,FluentWait,PageLoadTimeOut

A Interview Questions- selenium