Java Code Examples for org.openqa.selenium.Keys#DELETE

The following examples show how to use org.openqa.selenium.Keys#DELETE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonMethods.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
Keys getKeyCode(String data) {
    switch (data) {
        case "tab":
            return Keys.TAB;
        case "enter":
            return Keys.ENTER;
        case "shift":
            return Keys.SHIFT;
        case "ctrl":
            return Keys.CONTROL;
        case "alt":
            return Keys.ALT;
        case "esc":
            return Keys.ESCAPE;
        case "delete":
            return Keys.DELETE;
        case "backspace":
            return Keys.BACK_SPACE;
        case "home":
            return Keys.HOME;
        default:
            try {
                return Keys.valueOf(data.toUpperCase());
            } catch (Exception ex) {
                return null;
            }
    }
}
 
Example 2
Source File: BaseMethods.java    From akita with Apache License 2.0 5 votes vote down vote up
public void cleanField(String nameOfField) {
    SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(nameOfField);
    Keys removeKey = isIE() ? Keys.BACK_SPACE : Keys.DELETE;
    do {
        valueInput.shouldNotBe(readonly, disabled).doubleClick().sendKeys(removeKey);
    } while (valueInput.getValue().length() != 0);
}