Example usage for org.openqa.selenium Keys ARROW_LEFT

List of usage examples for org.openqa.selenium Keys ARROW_LEFT

Introduction

In this page you can find the example usage for org.openqa.selenium Keys ARROW_LEFT.

Prototype

Keys ARROW_LEFT

To view the source code for org.openqa.selenium Keys ARROW_LEFT.

Click Source Link

Usage

From source file:org.eclipse.che.selenium.refactor.methods.RenameStaticMethodsTest.java

License:Open Source License

private void doRefactorByWizard(int cursorPositionLine, int cursorPositionChar, String newName) {
    prepareProjectForRefactor(cursorPositionLine, cursorPositionChar);
    editor.launchRefactorFormFromEditor();
    editor.launchRefactorFormFromEditor();
    refactor.waitRenameMethodFormIsOpen();
    refactor.typeNewName(newName);//from   w  w w .  j  a v a  2  s  .  c  om
    refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactor.clickOkButtonRefactorForm();
    refactor.waitRenameMethodFormIsClosed();
}

From source file:org.eclipse.che.selenium.refactor.methods.RenameVirtualMethodsTest.java

License:Open Source License

private void doRefactorByWizard(int cursorPositionLine, int cursorPositionChar, String newName) {
    prepareProjectForRefactor(cursorPositionLine, cursorPositionChar);
    editor.launchRefactorFormFromEditor();
    editor.launchRefactorFormFromEditor();
    refactor.waitRenameMethodFormIsOpen();
    refactor.typeNewName(newName);/*from  ww  w  .  j ava 2s.c  o m*/
    refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    //need for validation on server side
    WaitUtils.sleepQuietly(2);
    refactor.clickOkButtonRefactorForm();
    refactor.waitRenameMethodFormIsClosed();
}

From source file:org.eclipse.che.selenium.refactor.parameters.RenameParametersTest.java

License:Open Source License

@Test(priority = 9)
public void checkRenameParameters28() throws Exception {
    setFieldsForTest("test28");
    projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java");
    editor.waitActiveEditor();//from   ww w  .j a va2s  . co m
    editor.waitTextIntoEditor(contentFromInA);
    editor.setCursorToDefinedLineAndChar(14, 18);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString());
    editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString());
    editor.launchRefactorFormFromEditor();
    editor.typeTextIntoEditor("j");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.waitTextIntoEditor(contentFromOutA);
    editor.closeFileByNameWithSaving("A");
}

From source file:org.eclipse.che.selenium.refactor.types.GenericsTest.java

License:Open Source License

@Test
public void testGenerics2() throws Exception {
    projectExplorer.waitVisibleItem(nameOfProject);
    projectExplorer.quickExpandWithJavaScript();

    loader.waitOnClosed();/*from w w w .j  a  v  a 2  s . co  m*/
    setFieldsForTest("testGenerics2");
    projectExplorer.scrollAndselectItem(pathToCurrentPackage + "/A.java");
    projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java");
    Assert.assertEquals(editor.getVisibleTextFromEditor(), contentFromInA);
    editor.waitTextIntoEditor(contentFromInA);
    projectExplorer.selectItem(pathToCurrentPackage + "/A.java");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING,
            TestMenuCommandsConstants.Assistant.Refactoring.RENAME);

    refactorPanel.typeNewName("B.java");
    refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactorPanel.clickOkButtonRefactorForm();
    askDialog.waitFormToOpen();
    askDialog.acceptDialogWithText("Found potential matches. Please review changes on the preview page.");
    askDialog.waitFormToClose();
    projectExplorer.waitItem(pathToCurrentPackage + "/B.java");
    Assert.assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB);
    editor.waitTextIntoEditor(contentFromOutB);
}

From source file:org.eclipse.che.selenium.refactor.types.RenameTypeTest.java

License:Open Source License

private void testCase() {
    projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java");
    editor.waitTextIntoEditor(contentFromInA);
    projectExplorer.selectItem(pathToCurrentPackage + "/A.java");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING,
            TestMenuCommandsConstants.Assistant.Refactoring.RENAME);

    refactorPanel.typeNewName("B.java");

    try {/*from ww w  .ja  va2 s .c o m*/
        refactorPanel.clickOkButtonRefactorForm();
    } catch (org.openqa.selenium.TimeoutException ex) {
        //For response from server side if a net works too slowly
        WaitUtils.sleepQuietly(1);
        refactorPanel.typeNewName("B.java");
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.clickOkButtonRefactorForm();
    }
    askDialog.waitFormToOpen();
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    refactorPanel.waitRefactorPreviewFormIsClosed();
    projectExplorer.waitItem(pathToCurrentPackage + "/B.java", 6);
    editor.waitTextIntoEditor(contentFromOutB);
}

From source file:org.eclipse.che.selenium.refactor.types.TestAnnotationsTest.java

License:Open Source License

@Test
public void testAnnotation1() throws Exception {
    projectExplorer.waitVisibleItem(nameOfProject);
    projectExplorer.quickExpandWithJavaScript();
    loader.waitOnClosed();//  ww  w  .j a v a  2s  .  c om
    setFieldsForTest("testAnnotation1");
    projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java");
    editor.waitTextIntoEditor(contentFromInA);
    projectExplorer.selectItem(pathToCurrentPackage + "/A.java");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING,
            TestMenuCommandsConstants.Assistant.Refactoring.RENAME);

    refactorPanel.typeNewName("B.java");
    try {
        refactorPanel.clickOkButtonRefactorForm();
    } catch (org.openqa.selenium.TimeoutException ex) {
        refactorPanel.typeNewName("B.java");
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.clickOkButtonRefactorForm();
    }
    askDialog.waitFormToOpen();
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    projectExplorer.waitItem(pathToCurrentPackage + "/B.java");
    editor.waitTextIntoEditor(contentFromInB);
}

From source file:org.eclipse.che.selenium.refactor.types.TestEnumerationsTest.java

License:Open Source License

@Test
public void testEnum1() throws Exception {
    projectExplorer.waitVisibleItem(NAME_OF_PROJECT);
    consoles.closeProcessesArea();/*w  w w .ja  v a 2 s  . co  m*/
    projectExplorer.quickExpandWithJavaScript();
    loader.waitOnClosed();
    setFieldsForTest("testEnum1");
    projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java");
    editor.waitTextIntoEditor(contentFromInA);
    projectExplorer.selectItem(pathToCurrentPackage + "/A.java");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING,
            TestMenuCommandsConstants.Assistant.Refactoring.RENAME);

    refactorPanel.typeNewName("B.java");
    refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
    refactorPanel.clickOkButtonRefactorForm();
    askDialog.waitFormToOpen();
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    projectExplorer.waitItem(pathToCurrentPackage + "/B.java");
    Assert.assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB);
    editor.waitTextIntoEditor(contentFromOutB);
}

From source file:org.eclipse.che.selenium.refactor.types.TestFailTest.java

License:Open Source License

/**
 * type new class into field of the refactoring widget and clickOkBtn
 *
 * @param newClassName the new class for refactoring
 *///from   w w w .  j  a  v a  2  s  . c  o  m
private void doRefactorWithWifget(String newClassName) {
    try {
        refactorPanel.typeNewName(newClassName);
        refactorPanel.clickOkButtonRefactorForm();
    } catch (WebDriverException ex) {
        ex.printStackTrace();
        refactorPanel.typeNewName(newClassName);
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString());
        refactorPanel.clickOkButtonRefactorForm();
    }
}

From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarModel.java

License:Open Source License

@Test
@IssueTracking("https://issues.jboss.org/browse/RF-14199")
public void testDisabledDayCannotBePickedByKeyboard() {
    DateTime referenceDate = new DateTime().withYear(2015).withMonthOfYear(11).withDayOfMonth(2)
            .withHourOfDay(12).withMinuteOfHour(0);
    // set reference date
    Graphene.guardAjax(popupCalendar).setDateTime(referenceDate);
    performStabilizationWorkaround();/*ww  w .  j  a v a  2  s  . c  o m*/

    popupCalendar.openPopup();
    checkSelectedDate(referenceDate);

    // try to select tuesday (disabled)
    keyboard.sendKeys(Keys.ARROW_RIGHT);
    keyboard.sendKeys(Keys.ENTER);
    assertTrue(popupCalendar.getPopup().isVisible());
    // check date is still the same (no move through enabled and already not selected days)
    checkSelectedDate(referenceDate);

    // try to select sunday (disabled)
    keyboard.sendKeys(Keys.ARROW_LEFT);
    keyboard.sendKeys(Keys.ARROW_LEFT);
    keyboard.sendKeys(Keys.ENTER);
    assertTrue(popupCalendar.getPopup().isVisible());
    // check date is still the same (no move through enabled and already not selected days)
    checkSelectedDate(referenceDate);

    // try to select saturday from previous month (disabled)
    Graphene.guardAjax(keyboard).sendKeys(Keys.ARROW_LEFT);// move to previous month will trigger an ajax request
    keyboard.sendKeys(Keys.ENTER);
    assertTrue(popupCalendar.getPopup().isVisible());
    // check date is still the same (no move through enabled and already not selected days)
    checkSelectedDate(referenceDate);

    // try to select thursday from previous year (disabled)
    Graphene.guardAjax(keyboard).sendKeys(Keys.chord(Keys.SHIFT, Keys.PAGE_UP));// move to previous year will trigger an ajax request
    keyboard.sendKeys(Keys.ARROW_LEFT);
    keyboard.sendKeys(Keys.ENTER);
    assertTrue(popupCalendar.getPopup().isVisible());
    // check selected date has changed (day moved to friday when the year was switched)
    // 2x to the left and 1x to previous year
    referenceDate = referenceDate.minusDays(2).minusYears(1);
    checkSelectedDate(referenceDate);

    // finally, select wednesday (enabled)
    Graphene.guardAjax(keyboard).sendKeys(Keys.ARROW_LEFT);
    keyboard.sendKeys(Keys.ENTER);
    popupCalendar.getPopup().waitUntilIsNotVisible().perform();

    referenceDate = referenceDate.withYear(2014).withMonthOfYear(10).withDayOfMonth(29);
    checkSelectedDate(referenceDate);
}

From source file:org.safs.selenium.webdriver.lib.WDLibrary.java

License:Open Source License

/**
 * Convert a Java KEYCODE to a Selenium WebDriver Keys Enum
 * @param keycode int, a java keycode/*w  w w. ja  v  a2 s. c  o m*/
 * @return Keys enum for (primarily) non-printable (control) characters, or null.
 */
public static Keys convertToKeys(int keycode) {
    Keys key = null;
    switch (keycode) {
    case java.awt.event.KeyEvent.VK_ADD:
        key = Keys.ADD;
        break;
    case java.awt.event.KeyEvent.VK_ALT:
        key = Keys.ALT;
        break;
    case java.awt.event.KeyEvent.VK_KP_DOWN:
        key = Keys.ARROW_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_KP_LEFT:
        key = Keys.ARROW_LEFT;
        break;
    case java.awt.event.KeyEvent.VK_KP_RIGHT:
        key = Keys.ARROW_RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_KP_UP:
        key = Keys.ARROW_UP;
        break;
    case java.awt.event.KeyEvent.VK_BACK_SPACE:
        key = Keys.BACK_SPACE;
        break;
    case java.awt.event.KeyEvent.VK_CANCEL:
        key = Keys.CANCEL;
        break;
    case java.awt.event.KeyEvent.VK_CLEAR:
        key = Keys.CLEAR;
        break;
    case java.awt.event.KeyEvent.VK_WINDOWS:
        key = Keys.COMMAND;
        break;
    case java.awt.event.KeyEvent.VK_CONTROL:
        key = Keys.CONTROL;
        break;
    case java.awt.event.KeyEvent.VK_DECIMAL:
        key = Keys.DECIMAL;
        break;
    case java.awt.event.KeyEvent.VK_DELETE:
        key = Keys.DELETE;
        break;
    case java.awt.event.KeyEvent.VK_DIVIDE:
        key = Keys.DIVIDE;
        break;
    case java.awt.event.KeyEvent.VK_DOWN:
        key = Keys.DOWN;
        break;
    case java.awt.event.KeyEvent.VK_END:
        key = Keys.END;
        break;
    case java.awt.event.KeyEvent.VK_ENTER:
        key = Keys.ENTER;
        break;
    case java.awt.event.KeyEvent.VK_EQUALS:
        key = Keys.EQUALS;
        break;
    case java.awt.event.KeyEvent.VK_ESCAPE:
        key = Keys.ESCAPE;
        break;
    case java.awt.event.KeyEvent.VK_F1:
        key = Keys.F1;
        break;
    case java.awt.event.KeyEvent.VK_F2:
        key = Keys.F2;
        break;
    case java.awt.event.KeyEvent.VK_F3:
        key = Keys.F3;
        break;
    case java.awt.event.KeyEvent.VK_F4:
        key = Keys.F4;
        break;
    case java.awt.event.KeyEvent.VK_F5:
        key = Keys.F5;
        break;
    case java.awt.event.KeyEvent.VK_F6:
        key = Keys.F6;
        break;
    case java.awt.event.KeyEvent.VK_F7:
        key = Keys.F7;
        break;
    case java.awt.event.KeyEvent.VK_F8:
        key = Keys.F8;
        break;
    case java.awt.event.KeyEvent.VK_F9:
        key = Keys.F9;
        break;
    case java.awt.event.KeyEvent.VK_F10:
        key = Keys.F10;
        break;
    case java.awt.event.KeyEvent.VK_F11:
        key = Keys.F11;
        break;
    case java.awt.event.KeyEvent.VK_F12:
        key = Keys.F12;
        break;
    case java.awt.event.KeyEvent.VK_HELP:
        key = Keys.HELP;
        break;
    case java.awt.event.KeyEvent.VK_HOME:
        key = Keys.HOME;
        break;
    case java.awt.event.KeyEvent.VK_INSERT:
        key = Keys.INSERT;
        break;
    case java.awt.event.KeyEvent.VK_LEFT:
        key = Keys.LEFT;
        break;
    case java.awt.event.KeyEvent.VK_META:
        key = Keys.META;
        break;
    case java.awt.event.KeyEvent.VK_MULTIPLY:
        key = Keys.MULTIPLY;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD0:
        key = Keys.NUMPAD0;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD1:
        key = Keys.NUMPAD1;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD2:
        key = Keys.NUMPAD2;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD3:
        key = Keys.NUMPAD3;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD4:
        key = Keys.NUMPAD4;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD5:
        key = Keys.NUMPAD5;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD6:
        key = Keys.NUMPAD6;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD7:
        key = Keys.NUMPAD7;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD8:
        key = Keys.NUMPAD8;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD9:
        key = Keys.NUMPAD9;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_DOWN:
        key = Keys.PAGE_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_UP:
        key = Keys.PAGE_UP;
        break;
    case java.awt.event.KeyEvent.VK_PAUSE:
        key = Keys.PAUSE;
        break;
    case java.awt.event.KeyEvent.VK_RIGHT:
        key = Keys.RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_SEMICOLON:
        key = Keys.SEMICOLON;
        break;
    case java.awt.event.KeyEvent.VK_SEPARATOR:
        key = Keys.SEPARATOR;
        break;
    case java.awt.event.KeyEvent.VK_SHIFT:
        key = Keys.SHIFT;
        break;
    case java.awt.event.KeyEvent.VK_SPACE:
        key = Keys.SPACE;
        break;
    case java.awt.event.KeyEvent.VK_SUBTRACT:
        key = Keys.SUBTRACT;
        break;
    case java.awt.event.KeyEvent.VK_TAB:
        key = Keys.TAB;
        break;
    case java.awt.event.KeyEvent.VK_UP:
        key = Keys.UP;
        break;
    }
    return key;
}