List of usage examples for org.openqa.selenium.interactions Actions Actions
public Actions(WebDriver driver)
From source file:com.vaadin.tests.components.grid.basicfeatures.server.GridSortingTest.java
License:Apache License
private void releaseKey(Keys key) { new Actions(getDriver()).keyUp(key).perform(); }
From source file:com.vaadin.tests.components.grid.GridClientRenderers.java
License:Apache License
@Test public void testComplexRendererOnActivate() { openTestURL();/*from www. ja v a2s .co m*/ GridCellElement cell = getGrid().getCell(3, 1); cell.click(); new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); assertEquals("onActivate was not called on KeyDown Enter.", "Activated!", cell.getText()); cell = getGrid().getCell(4, 1); cell.click(); new Actions(getDriver()).moveToElement(cell).doubleClick().perform(); assertEquals("onActivate was not called on double click.", "Activated!", cell.getText()); }
From source file:com.vaadin.tests.components.grid.GridThemeUITest.java
License:Apache License
private void openEditor(GridCellElement targetCell) { new Actions(getDriver()).doubleClick(targetCell).perform(); try {/*from w ww .jav a2 s . c o m*/ if (grid.getEditor().isDisplayed()) { return; } } catch (Exception e) { } // Try again if IE happen to fail.. new Actions(getDriver()).doubleClick(targetCell).perform(); }
From source file:com.vaadin.tests.components.grid.WidgetRenderersTest.java
License:Apache License
@Test public void testButtonRendererAfterCellBeingFocused() { GridCellElement buttonCell = getGridCell(0, 1); assertFalse("cell should not be focused before focusing", buttonCell.isFocused()); // avoid clicking on the button buttonCell.click(buttonCell.getSize().getWidth() - 10, 5); assertTrue("cell should be focused after focusing", buttonCell.isFocused()); WebElement button = buttonCell.findElement(By.className("v-nativebutton")); assertNotEquals("Button should not be clicked before click", "Clicked!", button.getText()); new Actions(getDriver()).moveToElement(button).click().perform(); waitUntilTextUpdated(button, "Clicked!"); }
From source file:com.vaadin.tests.components.nativeselect.NativeSelectsFocusAndBlurListenerTests.java
License:Apache License
private void menuSub(String string) { getDriver().findElement(By.xpath("//span[text() = '" + string + "']")).click(); new Actions(getDriver()).moveByOffset(100, 0).build().perform(); }
From source file:com.vaadin.tests.components.tree.TreeContextMenuAndIconsTest.java
License:Apache License
private WebElement openContextMenu(WebElement element) { Actions actions = new Actions(getDriver()); // Note: on Firefox, the first menu item does not get focus; on other // browsers it does actions.contextClick(element);/*from ww w.ja va 2 s .c om*/ actions.perform(); return findElement(By.className("v-contextmenu")); }
From source file:com.vaadin.tests.components.tree.TreeItemClickListeningTest.java
License:Apache License
private void performLeftClick() { new Actions(driver).click(getTreeNode("Caption 1")).build().perform(); }
From source file:com.vaadin.tests.components.tree.TreeItemClickListeningTest.java
License:Apache License
private void performRightClick() { new Actions(driver).contextClick(getTreeNode("Caption 2")).build().perform(); }
From source file:com.vaadin.tests.components.tree.TreeItemDoubleClickTest.java
License:Apache License
private void doubleClick(WebElement element) { new Actions(getDriver()).doubleClick(element).build().perform(); }
From source file:com.vaadin.tests.components.tree.TreeItemSelectionWithoutImmediateTest.java
License:Apache License
@Test public void testSelectTreeWithItemClickListenerNotImmediate() throws InterruptedException { openTestURL();//from ww w . java2 s . c o m // click on item i (in circle we select next item and check if it is // selected in tree) for (int i = 1; i <= 4; i++) { WebElement treeItem = getTreeNode( String.format(TreeItemSelectionWithoutImmediate.MENU_ITEM_TEMPLATE, i)); new Actions(getDriver()).moveToElement(treeItem).click().perform(); Thread.sleep(100); WebElement selectedElement = driver.findElement(By.className("v-tree-node-selected")); treeItem = getTreeNode(String.format(TreeItemSelectionWithoutImmediate.MENU_ITEM_TEMPLATE, i)); assertThat("Clicked element should be selected", selectedElement.getText().equals(treeItem.getText()), is(true)); } }