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:com.vaadin.addon.charts.testbenchtests.RangeSelectorCustomDateParserTBTest.java

private void setRangeValue(String value, WebElement input) {
    Actions action = new Actions(driver);
    //Should be done as one action, otherwise does not work
    action.doubleClick(input).sendKeys(Keys.chord(Keys.CONTROL, "a")).sendKeys(Keys.BACK_SPACE).sendKeys(value)
            .sendKeys(Keys.TAB).perform();
}

From source file:com.vaadin.tests.components.textfield.AutomaticImmediateTest.java

License:Apache License

@Test
public void test() {
    openTestURL();//from   www.  j a va 2s  .  c  om

    WebElement field = getDriver().findElement(By.id(AutomaticImmediate.FIELD));

    WebElement toggle = getDriver().findElement(By.xpath("//input[@type = 'checkbox']"));

    WebElement explicitFalseButton = getDriver().findElement(By.id(AutomaticImmediate.EXPLICIT_FALSE));

    WebElement hitServerButton = getDriver().findElement(By.id(AutomaticImmediate.BUTTON));

    String string = getRandomString();
    field.sendKeys(string + Keys.ENTER);

    // Non immediate, just the initial server side valuechange
    assertLastLog("1. fireValueChange");

    hitServerButton.click();

    // No value change, but value sent to server
    assertLastLog("2. fireValueChange");

    // listener on -> immediate on
    toggle.click();

    string = getRandomString();
    String delSequence = "" + Keys.BACK_SPACE + Keys.BACK_SPACE;
    field.sendKeys(delSequence + string + Keys.ENTER);
    assertLastLog("4. Value changed: " + string);

    // listener off -> immediate off
    String lastvalue = string;
    toggle.click();
    string = getRandomString();
    field.sendKeys(delSequence + string + Keys.ENTER);
    // No new value change should happen...
    assertLastLog("4. Value changed: " + lastvalue);
    hitServerButton.click();
    // ... but server should receive value with roundtrip
    assertLastLog("5. fireValueChange");

    // explicitly non immediate, but with listener
    explicitFalseButton.click();
    toggle.click();

    string = getRandomString();
    field.sendKeys(delSequence + string + Keys.ENTER);
    // non immediate, no change...
    assertLastLog("5. fireValueChange");
    // ... until server round trip
    hitServerButton.click();
    assertLastLog("7. Value changed: " + string);

}

From source file:info.magnolia.integrationtests.uitest.LogToolsAppUITest.java

License:Open Source License

@Test
public void testFilters() {
    // GIVEN/*  ww w.j  a va 2  s .c  o  m*/
    goToSubApp(LOG_LEVELS);
    String filterPattern = "WARN";

    // WHEN
    WebElement nameFilter = getElement(By.xpath("//input[contains(@class, 'v-textfield')]"));
    nameFilter.sendKeys(FILTER_SEARCH_PATTERN);
    delay("Wait for the grid to refresh");
    assertPatternIsInAllColumnRows("//tbody/tr[contains(@class, 'v-grid-row')]/*[1]", FILTER_SEARCH_PATTERN,
            true);

    // THEN
    // nameFilter.clear() is cleaner than this but it doesn't revert the grid filtering, probably because it's too fast
    nameFilter.click();
    for (int i = 0; i < FILTER_SEARCH_PATTERN.length(); i++) {
        nameFilter.sendKeys(Keys.BACK_SPACE);
    }
    delay("Wait for the grid to refresh");

    // WHEN
    WebElement levelFilter = getElement(
            By.xpath("//thead/*[2]/*[3]/div/select[contains(@class, 'v-select-select')]"));
    levelFilter.sendKeys(filterPattern);
    levelFilter.sendKeys(Keys.ENTER);
    delay("Wait for the grid to refresh");
    // THEN
    assertPatternIsInAllColumnRows("//tbody/tr[contains(@class, 'v-grid-row')]/*[3]", filterPattern, false);
}

From source file:org.apache.falcon.regression.ui.search.SearchPage.java

License:Apache License

public void removeLastParam() {
    focusOnSearchBox();
    getSearchBox().sendKeys(Keys.BACK_SPACE);
    getSearchBox().sendKeys(Keys.BACK_SPACE);
}

From source file:org.auraframework.integration.test.components.ui.inputSmartNumber.BaseInputSmartNumber.java

License:Apache License

/**
 * Test change event is only fired when input value is changed
 *//*from  w w w .j ava 2  s .co  m*/
public void testChangeEvent() throws Exception {
    open(URL);
    WebElement inputElm = findDomElement(By.cssSelector(INPUT_SEL));
    WebElement submitBtnElm = findDomElement(By.cssSelector(SUBMIT_SEL));
    WebElement clearEventsBtn = findDomElement(By.cssSelector(CLEAR_EVENTS_SEL));

    // new value, change event should be fired
    inputElm.sendKeys("123");
    submitBtnElm.click();
    verifyEventsFired(EVENTLIST_SEL, "change");

    // clear events to check the next step
    clearEventsBtn.click();
    getAuraUITestingUtil().waitForElementNotPresent("Event list should be cleared",
            By.cssSelector(EVENTLIST_SEL));

    // change event should be fired if value has not changed
    inputElm.sendKeys("1", Keys.BACK_SPACE);
    submitBtnElm.click();
    verifyEventsNotFired(EVENTLIST_SEL, "change");
}

From source file:org.callimachusproject.webdriver.pages.TextEditor.java

License:Apache License

private TextEditor clear() {
    browser.focusInFrame(topFrameName, "editor-iframe");
    // shift/control does not appear to work in IE
    CharSequence[] keys = new CharSequence[1024];
    for (int i = 0; i < keys.length; i++) {
        keys[i] = Keys.BACK_SPACE;
    }/* www  .  java  2  s.  c o m*/
    browser.sendKeys(By.tagName("textarea"), keys);
    return this;
}

From source file:org.eclipse.che.selenium.debugger.BreakpointReorderingTest.java

License:Open Source License

@Test(priority = 1)
public void shouldNotRemoveBreakpointWhenLastCharacterRemoved() throws Exception {
    editor.goToCursorPositionVisible(26, 65);
    actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.BACK_SPACE).build().perform();

    editor.waitInactiveBreakpoint(26);/*from   ww  w .  j  a v a  2 s  . co  m*/
}

From source file:org.eclipse.che.selenium.editor.autocomplete.AutocompleteFeaturesInEditorTest.java

License:Open Source License

private void reparseEditorCode() {
    editor.setCursorToLine(36);/*w  w w. ja  v  a 2s .c o m*/
    editor.typeTextIntoEditor("a");
    editor.waitMarkerInPosition(ERROR_MARKER, 36);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    editor.waitMarkerDisappears(ERROR_MARKER, 36);
}

From source file:org.eclipse.che.selenium.editor.autocomplete.AutocompleteJSFilesTest.java

License:Open Source License

@Test
public void checkAutocompleteJSFilesTest() {
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.openItemByPath(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    projectExplorer.waitProjectExplorer();
    projectExplorer.quickExpandWithJavaScript();
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE);
    askForValueDialog.typeAndWaitText("newJsFile");
    askForValueDialog.clickOkBtn();//  ww w  .j  ava 2  s  . c  o  m
    loader.waitOnClosed();
    projectExplorer.waitItemInVisibleArea("newJsFile.js");

    editor.waitActiveEditor();
    loader.waitOnClosed();
    editor.setCursorToLine(1);

    editor.typeTextIntoEditorWithoutDelayForSaving("function a (");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("{");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("var b = 5;");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("var c = ");

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("b", " : number");

    editor.typeTextIntoEditorWithoutDelayForSaving(";");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("return c;");
    editor.setCursorToLine(5);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("a()", " : number");

    editor.typeTextIntoEditorWithoutDelayForSaving(";");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("/**");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    Assert.assertEquals(editor.getVisibleTextFromEditor(), EXPECTED_TEXT);

    editor.setCursorToLine(9);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("function f (");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("{");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("return 'test text';");
    editor.setCursorToLine(12);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("f()", " : string");
    editor.typeTextIntoEditorWithoutDelayForSaving(";");

    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.setCursorToLine(11);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.BACK_SPACE.toString());

    editor.waitMarkerInPositionAndClick(INFO_MARKER, 11);
    editor.clickOnElementByXpath("//button[text()='Add missing semicolon']");

    editor.waitAllMarkersDisappear(INFO_MARKER);
    loader.waitOnClosed();
}

From source file:org.eclipse.che.selenium.editor.SplitEditorFeatureTest.java

License:Open Source License

@Test(priority = 2)
public void checkRefactoring() {
    editor.selectTabByIndexEditorWindow(2, NAME_JAVA_CLASS);
    editor.waitActiveEditor();//from   w  ww.  j av a  2 s.c  o  m
    projectExplorer.selectItem(PATH_JAVA_FILE);
    projectExplorer.launchRefactorByKeyboard();
    refactor.typeAndWaitNewName(NEW_NAME_JAVA);
    refactor.sendKeysIntoField(Keys.SPACE.toString());
    refactor.sendKeysIntoField(Keys.BACK_SPACE.toString());
    refactor.clickOkButtonRefactorForm();
    editor.waitActiveEditor();
    editor.selectTabByIndexEditorWindow(1, NEW_NAME);
    editor.waitActiveEditor();
    editor.selectTabByIndexEditorWindow(0, NEW_NAME);
    editor.waitActiveEditor();
    editor.setCursorToLine(2);
    editor.typeTextIntoEditor("//" + TEXT);
    editor.waitTextIntoEditor("//" + TEXT);
    editor.selectTabByIndexEditorWindow(1, NEW_NAME);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("//" + TEXT);
    editor.selectTabByIndexEditorWindow(2, NEW_NAME);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("//" + TEXT);
}