Example usage for org.openqa.selenium Keys BACK_SPACE

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

Introduction

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

Prototype

Keys BACK_SPACE

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

Click Source Link

Usage

From source file:org.eclipse.che.selenium.filewatcher.EditFilesWithTabsTest.java

License:Open Source License

@Test
public void checkEditingFilesFromIde() throws Exception {
    String textForValidation = "//check test message for java file";
    String textForValidationTxt1 = "//check test message for file1.txt file";
    String expectedNotificationMess1 = "File 'AppController.java' is updated";
    String expectedNotificationMess2 = "File 'file1.txt' is updated";
    String nameReadmeFile = "README.md";
    String nameFiletxt1 = "file1.txt";

    editor1.setCursorToLine(1);//w  ww.ja  v a  2s.  c  o m
    editor1.typeTextIntoEditor(textForValidation);
    editor1.typeTextIntoEditor(Keys.ENTER.toString());

    eventsTab2.waitExpectedMessage(expectedNotificationMess1);
    editor2.waitTextIntoEditor(textForValidation);
    projectExplorer1.openItemByPath(projectName + "/" + nameReadmeFile);
    projectExplorer1.openItemByPath(projectName + "/" + nameFiletxt1);
    projectExplorer2.openItemByPath(projectName + "/" + nameReadmeFile);
    projectExplorer2.openItemByPath(projectName + "/" + nameFiletxt1);
    editor2.typeTextIntoEditor(textForValidationTxt1);

    eventsTab1.waitExpectedMessage(expectedNotificationMess2);
    eventsTab1.clearAllMessages();

    editor1.closeFileByNameWithSaving(nameFiletxt1);
    editor2.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    editor2.typeTextIntoEditor(Keys.BACK_SPACE.toString());

    checkThatNotificationIsNotAppear(8, 500, expectedNotificationMess1);
}

From source file:org.eclipse.che.selenium.git.GitColorsTest.java

License:Open Source License

@Test(priority = 3)
public void testModifiedFilesColor() {
    // Check file is colored in default color
    projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md");
    editor.waitDefaultColorTab("README.md");

    // Make a change
    editor.selectTabByName("README.md");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.waitTabFileWithSavedStatus("README.md");
    projectExplorer.waitBlueNode(PROJECT_NAME + "/README.md");
    editor.waitBlueTab("README.md");

    // check that the file color is blue
    editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    editor.waitTabFileWithSavedStatus("README.md");
    projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md");
    editor.waitDefaultColorTab("README.md");
}

From source file:org.eclipse.che.selenium.languageserver.CheckMainFeatureForCharpLanguageTest.java

License:Open Source License

@Test
public void checkLaunchingCodeserver() throws Exception {
    projectExplorer.waitProjectExplorer();
    menu.runCommand(TestMenuCommandsConstants.Workspace.WORKSPACE,
            TestMenuCommandsConstants.Workspace.CREATE_PROJECT);
    wizard.selectSample(Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE);
    wizard.typeProjectNameOnWizard(PROJECT_NAME);
    wizard.clickCreateButton();//from  www.j av a 2 s.  c  o  m
    wizard.waitCloseProjectConfigForm();
    projectExplorer.openItemByPath(PROJECT_NAME);
    projectExplorer.waitItem(PROJECT_NAME + "/Program.cs", 240);
    projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs");
    loader.waitOnClosed();
    editor.setCursorToDefinedLineAndChar(24, 12);
    for (int i = 0; i < 9; i++) {
        editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    }
    editor.waitMarkerInPosition(ERROR_MARKER, 23);
    editor.waitMarkerInPosition(ERROR_MARKER, 21);
    editor.setCursorToDefinedLineAndChar(23, 49);
    editor.typeTextIntoEditor(".");
    editor.launchAutocomplete();
    editor.enterAutocompleteProposal("Build() ");
    editor.typeTextIntoEditor(";");
    editor.waitAllMarkersDisappear(ERROR_MARKER);
}

From source file:org.eclipse.che.selenium.languageserver.CheckMainFeatureForCSharpLanguageTest.java

License:Open Source License

@Test
public void checkLaunchingCodeserver() {
    projectExplorer.waitProjectExplorer();
    menu.runCommand(TestMenuCommandsConstants.Workspace.WORKSPACE,
            TestMenuCommandsConstants.Workspace.CREATE_PROJECT);
    wizard.selectSample(Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE);
    wizard.typeProjectNameOnWizard(PROJECT_NAME);
    wizard.clickCreateButton();/*from w  ww  .  j  a  v a 2  s.  c  o m*/
    wizard.waitCloseProjectConfigForm();
    projectExplorer.openItemByPath(PROJECT_NAME);
    projectExplorer.waitItem(PROJECT_NAME + "/Program.cs", 240);
    projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs");
    loader.waitOnClosed();
    checkLanguageServerInitStateAndLaunch();
    editor.goToCursorPositionVisible(24, 12);
    for (int i = 0; i < 9; i++) {
        editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    }
    editor.waitMarkerInPosition(ERROR, 23);
    editor.waitMarkerInPosition(ERROR, 21);
    editor.goToCursorPositionVisible(23, 49);
    editor.typeTextIntoEditor(".");
    editor.launchAutocomplete();
    editor.enterAutocompleteProposal("Build() ");
    editor.typeTextIntoEditor(";");
    editor.waitAllMarkersInvisibility(ERROR);
}

From source file:org.eclipse.che.selenium.languageserver.CheckMainFeatureForLanguageTest.java

License:Open Source License

@Test
public void checkLaunchingCodeserver() throws Exception {
    projectExplorer.waitProjectExplorer();
    menu.runCommand(TestMenuCommandsConstants.Workspace.WORKSPACE,
            TestMenuCommandsConstants.Workspace.CREATE_PROJECT);
    wizard.selectSample(Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE);
    wizard.typeProjectNameOnWizard(PROJECT_NAME);
    wizard.clickCreateButton();// w  ww  .  j  a v a  2 s  .co  m
    wizard.waitCloseProjectConfigForm();
    projectExplorer.openItemByPath(PROJECT_NAME);
    projectExplorer.waitItem(PROJECT_NAME + "/Program.cs", 240);
    projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs");
    loader.waitOnClosed();
    editor.setCursorToDefinedLineAndChar(16, 34);
    for (int i = 0; i < 8; i++) {
        editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    }
    editor.launchAutocomplete();
    editor.waitTextIntoAutocompleteContainer("Build()");
    editor.closeAutocomplete();
    editor.waitMarkerInPosition(ERROR_MARKER, 10);
    editor.waitMarkerInPosition(ERROR_MARKER, 18);
    editor.setCursorToDefinedLineAndChar(16, 26);
    editor.typeTextIntoEditor("Build();");
    editor.waitAllMarkersDisappear(ERROR_MARKER);
}

From source file:org.eclipse.che.selenium.miscellaneous.TerminalTypingTest.java

License:Open Source License

@Test
public void checkTerminalTypingCharsWithoutShift() {
    loader.waitOnClosed();/*from   w  ww .  j  a  va  2  s  . c o  m*/
    terminal.selectTerminalTab();
    terminal.waitTerminalConsole();
    terminal.waitTerminalIsNotEmpty();

    for (Pair<String, String> pair : keyPairs) {
        terminal.typeIntoTerminal(pair.first());
        terminal.waitExpectedTextIntoTerminal("/projects$ " + pair.first());
        terminal.typeIntoTerminal(Keys.BACK_SPACE.toString());
    }
}

From source file:org.eclipse.che.selenium.miscellaneous.TerminalTypingTest.java

License:Open Source License

@Test
public void checkTerminalTypingWithShift() {
    loader.waitOnClosed();/*from w w w.jav a  2  s  .com*/
    terminal.selectTerminalTab();
    terminal.waitTerminalConsole();
    terminal.waitTerminalIsNotEmpty();

    for (Pair<String, String> pair : keyPairs) {
        terminal.typeIntoTerminal(Keys.SHIFT + pair.first());
        terminal.waitExpectedTextIntoTerminal("/projects$ " + pair.second());
        terminal.typeIntoTerminal(Keys.BACK_SPACE.toString());
    }
}

From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java

License:Open Source License

protected Keys toSeleniumKey(Key key) {
    switch (key) {
    case Shift:/*from w ww  .  ja  v a 2  s  .  com*/
        return Keys.SHIFT;
    case Control:
        return Keys.CONTROL;
    case Alt:
        return Keys.ALT;
    case Delete:
        return Keys.DELETE;
    case Backspace:
        return Keys.BACK_SPACE;
    case Enter:
        return Keys.ENTER;
    case Esc:
        return Keys.ESCAPE;
    case Tab:
        return Keys.TAB;
    case ContextMenu:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    case Up:
        return Keys.UP;
    case Down:
        return Keys.DOWN;
    case Left:
        return Keys.LEFT;
    case Right:
        return Keys.RIGHT;
    case Windows:
        return Keys.META;
    case F1:
        return Keys.F1;
    case F2:
        return Keys.F2;
    case F3:
        return Keys.F3;
    case F4:
        return Keys.F4;
    case F5:
        return Keys.F5;
    case F6:
        return Keys.F6;
    case F7:
        return Keys.F7;
    case F8:
        return Keys.F8;
    case F9:
        return Keys.F9;
    case F10:
        return Keys.F10;
    case F11:
        return Keys.F11;
    case F12:
        return Keys.F12;
    case Home:
        return Keys.HOME;
    case End:
        return Keys.END;
    case PageUp:
        return Keys.PAGE_UP;
    case PageDown:
        return Keys.PAGE_DOWN;
    case NumPad0:
        return Keys.NUMPAD0;
    case NumPad1:
        return Keys.NUMPAD1;
    case NumPad2:
        return Keys.NUMPAD2;
    case NumPad3:
        return Keys.NUMPAD3;
    case NumPad4:
        return Keys.NUMPAD4;
    case NumPad5:
        return Keys.NUMPAD5;
    case NumPad6:
        return Keys.NUMPAD6;
    case NumPad7:
        return Keys.NUMPAD7;
    case NumPad8:
        return Keys.NUMPAD8;
    case NumPadMultiply:
        return Keys.MULTIPLY;
    case NumPadDivide:
        return Keys.DIVIDE;
    case NumPadAdd:
        return Keys.ADD;
    case NumPadSubtract:
        return Keys.SUBTRACT;
    case NumPadDecimal:
        return Keys.DECIMAL;
    case NumPadSeparator:
        return Keys.SEPARATOR;
    default:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    }
}

From source file:org.glowroot.agent.webdriver.tests.Utils.java

License:Apache License

public static void clearInput(WebElement element) {
    // select text (control-a) then hit backspace key
    element.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE);
}

From source file:org.jitsi.meet.test.DisplayNameTest.java

License:Apache License

/**
 * Changes the display name./*  w ww.  ja  v a  2 s.  c om*/
 * @param newName the name to change.
 */
private void changeDisplayName(String newName) {
    System.err.println("Start changeDisplayName for " + newName + ".");

    WebDriver secondParticipant = ConferenceFixture.getSecondParticipant();

    WebElement elem = secondParticipant
            .findElement(By.xpath("//span[@id='localVideoContainer']" + "//span[@id='localDisplayName']"));
    // hover the element before clicking
    Actions action0 = new Actions(secondParticipant);
    action0.moveToElement(elem);
    action0.perform();

    elem.click();

    WebElement inputElem = secondParticipant
            .findElement(By.xpath("//span[@id='localVideoContainer']" + "//input[@id='editDisplayName']"));
    Actions action = new Actions(secondParticipant);
    action.moveToElement(inputElem);
    action.perform();

    if (newName != null && newName.length() > 0)
        inputElem.sendKeys(newName);
    else
        inputElem.sendKeys(Keys.BACK_SPACE);

    inputElem.sendKeys(Keys.RETURN);
    // just click somewhere to lose focus, to make sure editing has ended
    String ownerResource = MeetUtils.getResourceJid(ConferenceFixture.getOwner());
    MeetUIUtils.clickOnRemoteVideo(secondParticipant, ownerResource);
    MeetUIUtils.clickOnRemoteVideo(secondParticipant, ownerResource);
}