List of usage examples for org.openqa.selenium Keys CONTROL
Keys CONTROL
To view the source code for org.openqa.selenium Keys CONTROL.
Click Source Link
From source file:org.richfaces.fragment.pickList.RichFacesPickList.java
License:Open Source License
protected void unselectAll(List<WebElement> list) { if (!list.isEmpty()) { new Actions(driver).click(list.get(0)).keyDown(Keys.CONTROL).click(list.get(0)).keyUp(Keys.CONTROL) .perform();//from w ww . j a v a 2s. c om if (!list.isEmpty()) { throw new RuntimeException("The unselection was not successfull."); } } }
From source file:org.richfaces.showcase.notify.page.NotifyAttributesPage.java
License:Open Source License
private void setInputValueTo(WebElement input, double value) { Action action = actions.click(input).sendKeys(Keys.chord(Keys.CONTROL, "a"), String.valueOf(value)) // blur the input .sendKeys(Keys.TAB).build(); if (!input.getAttribute("value").equals(String.valueOf(value))) { // value was changed => ajax request action = Graphene.guardAjax(action); }/*from w w w . ja v a 2 s.c o m*/ action.perform(); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestRF14032.java
License:Open Source License
@Test @IssueTracking("https://issues.jboss.org/browse/RF-14032") public void testSelectedYearWillChangeOnlyByArrowsPressing() { // set some reference date Graphene.guardAjax(popupCalendar).setDateTime(firstOfJanuary2012); waitUtilNoTimeoutsArePresent();/*from www . j a v a 2 s . c o m*/ PopupCalendar popup = popupCalendar.openPopup(); // set a different year and month than the reference date popup.getHeaderControls().openYearAndMonthEditor().selectDate(todayMidday).confirmDate(); DayPicker dayPicker = popup.getDayPicker(); // key press >>> selected day in day picker will NOT change keyboard.sendKeys("a"); assertNull(dayPicker.getSelectedDay()); // key press >>> selected day in day picker will NOT change keyboard.sendKeys(Keys.CONTROL); assertNull(dayPicker.getSelectedDay()); // arrow press >>> selected day in day picker will change keyboard.sendKeys(Keys.ARROW_RIGHT); assertNotNull(dayPicker.getSelectedDay()); // 1st january + arrow right >>> 2nd January assertEquals(dayPicker.getSelectedDay().getDayNumber(), Integer.valueOf(2)); }
From source file:org.richfaces.tests.metamer.ftest.richContextMenu.ContextMenuSimplePage.java
License:Open Source License
public void clickOnFirstPanel(DriverType type) { if (type == DriverType.InternetExplorer) { targetPanel1.sendKeys(Keys.CONTROL); } targetPanel1.click(); }
From source file:org.richfaces.tests.metamer.ftest.richContextMenu.ContextMenuSimplePage.java
License:Open Source License
public void clickOnSecondPanel(DriverType type) { if (type == DriverType.InternetExplorer) { targetPanel2.sendKeys(Keys.CONTROL); } targetPanel2.click(); }
From source file:org.richfaces.tests.metamer.ftest.richContextMenu.TestRF14023.java
License:Open Source License
@Test @IssueTracking({ "https://issues.jboss.org/browse/RF-14023", "https://issues.jboss.org/browse/RF-14156" }) public void testDynamicContextMenuAppearsAfterAjaxUpdateInEDT() { checkNoJSErrorsArePresent();/*from w w w. ja v a2 s.c o m*/ // select first row (this should be enough to prevent context menu from showing -- RF-14023) WebElement menuTarget = edt.getFirstRow().getStateColumn(); Graphene.guardAjax(menuTarget).click(); // show context menu on first row and select an item Graphene.guardAjax(contextMenu.expandGroup(0, menuTarget)).selectItem(0); // check output assertEquals(output.getText(), "Montgomery (Alabama)"); checkNoJSErrorsArePresent(); // select third row Graphene.guardAjax(edt.getRow(2).getStateColumn()).click(); checkNoJSErrorsArePresent(); // select multiple rows (third row remains selected from previous step) for (int index : new Integer[] { 0, 5, 10, 13 }) { jsUtils.scrollToView(edt.getRow(index).getRootElement()); edt.selectRow(index, Keys.CONTROL); } checkNoJSErrorsArePresent(); // show context menu on third row jsUtils.scrollToView(edt.getRow(2).getRootElement()); menuTarget = edt.getRow(2).getStateColumn(); PopupMenuGroup expandedGroup = contextMenu.expandGroup(0, menuTarget); assertEquals(contextMenu.advanced().getItemsElements().size(), 6);// 5 items + 1 group // select third item Graphene.guardAjax(expandedGroup).selectItem(2); // check output assertEquals(output.getText(), "Denver (Colorado)"); checkNoJSErrorsArePresent(); }
From source file:org.richfaces.tests.metamer.ftest.richDropDownMenu.AbstractDropDownMenuTest.java
License:Open Source License
@CoversAttributes("onkeydown") public void testOnkeydown() { updateDropDownMenuInvoker();//w w w.j av a 2s . c o m testFireEvent(dropDownMenuAttributes, DropDownMenuAttributes.onkeydown, new Action() { @Override public void perform() { getCurrentMenu().advanced().show(page.getTarget1()); new Actions(driver).keyDown(getCurrentMenu().advanced().getItemsElements().get(2), Keys.CONTROL) .keyUp(getCurrentMenu().advanced().getItemsElements().get(2), Keys.CONTROL).build() .perform(); } }); }
From source file:org.richfaces.tests.metamer.ftest.richExtendedDataTable.TestExtendedDataTableSelection.java
License:Open Source License
@Test @CoversAttributes({ "selection", "selectionMode" }) public void testSelectionModeMultipleKeyboardFree() { tableAttributes.set(ExtendedDataTableAttributes.selectionMode, "multipleKeyboardFree"); page.selectRow(2);// w ww . j ava 2 s. co m assertEquals(page.getActualPreviousSelection(), expectedSelection()); assertEquals(page.getActualCurrentSelection(), expectedSelection(2)); // select another row page.selectRow(4); assertEquals(page.getActualPreviousSelection(), expectedSelection(2)); assertEquals(page.getActualCurrentSelection(), expectedSelection(2, 4)); // select another record using CONTROL (no effect), another record is selected page.selectRow(7, Keys.CONTROL); assertEquals(page.getActualPreviousSelection(), expectedSelection(2, 4)); assertEquals(page.getActualCurrentSelection(), expectedSelection(2, 4, 7)); // select another record using SHIFT (no effect), another record is selected page.selectRow(0, Keys.SHIFT); assertEquals(page.getActualPreviousSelection(), expectedSelection(2, 4, 7)); assertEquals(page.getActualCurrentSelection(), expectedSelection(0, 2, 4, 7)); // deselect previously selected row page.deselectRow(4);// selecting and deselecting is performed by the same mechanism -- clicking on the row assertEquals(page.getActualPreviousSelection(), expectedSelection(0, 2, 4, 7)); assertEquals(page.getActualCurrentSelection(), expectedSelection(0, 2, 7)); }
From source file:org.richfaces.tests.metamer.ftest.richExtendedDataTable.TestExtendedDataTableSelection.java
License:Open Source License
@Test @IssueTracking("https://issues.jboss.org/browse/RF-11932") @CoversAttributes({ "selection", "selectionMode" }) public void testSelectionModeSingle() { tableAttributes.set(ExtendedDataTableAttributes.selectionMode, "single"); page.selectRow(2);//w ww . ja v a2s .c om assertEquals(page.getActualPreviousSelection(), expectedSelection()); assertEquals(page.getActualCurrentSelection(), expectedSelection(2)); // select another record using CONTROL, only one record is selected page.selectRow(4, Keys.CONTROL); assertEquals(page.getActualPreviousSelection(), expectedSelection(2)); assertEquals(page.getActualCurrentSelection(), expectedSelection(4)); // select another record using SHIFT, only one record is selected page.selectRow(7, Keys.SHIFT); assertEquals(page.getActualPreviousSelection(), expectedSelection(4)); assertEquals(page.getActualCurrentSelection(), expectedSelection(7)); // select another record using CONTROL+SHIFT, only one record is selected page.selectRow(3, Keys.CONTROL, Keys.SHIFT); assertEquals(page.getActualPreviousSelection(), expectedSelection(7)); assertEquals(page.getActualCurrentSelection(), expectedSelection(3)); // deselect row page.deselectRow(3, Keys.CONTROL); assertEquals(page.getActualPreviousSelection(), expectedSelection(3)); assertEquals(page.getActualCurrentSelection(), expectedSelection()); }
From source file:org.richfaces.tests.metamer.ftest.richHotKey.TestHotKeyAttributes.java
License:Open Source License
@Test public void testPreventDefaultFalse() { ATTRIBUTES_FIRST.set(HotKeyAttributes.preventDefault, Boolean.FALSE); try {/*from w ww . j av a2 s .c om*/ testKeyForPreventDefault(Keys.chord(Keys.CONTROL, "f"), "ctrl+f", 1); } finally { firstInput.getInput().sendKeys(Keys.ESCAPE); } }