@Test
public void performMouseActions()
{
Actions actions=new Actions(driver);
actions.moveToElement(driver.findElement(By.xpath("//a[@href='https://contribute.jquery.org/']"))).build().perform();
}
}
@Test
public void shiftKeyActiononSearchBox() {
WebElement searchbox=driver.findElement(By.xpath("//input[@name=\"s\"]"));
//Actions action=new Actions(driver);
searchbox.sendKeys(Keys.SHIFT,"textEnter");
}
}
@Test
public void actionOnDrop() throws InterruptedException {
WebElement droppableclick=driver.findElement(By.xpath("//a[@href=\"https://jqueryui.com/droppable/\"]"));
droppableclick.click();
driver.switchTo().frame(0);
WebElement draggable= driver.findElement(By.xpath("//html[@lang=\"en\"]/descendant::div[@id='draggable']"));
WebElement droppable= driver.findElement(By.xpath("//body/div[1][@id=\"draggable\"]//following-sibling::div[@id='droppable']"));
Actions action=new Actions(driver);
action.clickAndHold(draggable).moveToElement(droppable).release(draggable).build().perform();
//action.dragAndDrop(draggable, droppable).build().perform();
}
}
@Test
public void testSuccessHandleWindow() {
driver.findElement(By.linkText("Click Here")).click();
String parentWindow=driver.getWindowHandle();
System.out.println("Parent Window: "+parentWindow);
Set<String>allwin=driver.getWindowHandles();
System.out.println("all window in current browser" +allwin);
Iterator<String> it= allwin.iterator();
String childwin=it.next();
driver.switchTo().window(childwin);
driver.switchTo().window(parentWindow);
}
}
No comments:
Post a Comment