I know how to send click events with nightwatch:
browser.click('#my-control');
But I have been unable to find a way to send key events. How is this done in nightwatch?
You can try the following way to press any key in nightwatch.js; I am pressing T and it is working superb!
client.keys("t", function(done) {
client.pause(5000);
client.expect.element('#carousel_container').to.have.css('display').which.equals('block');
});
We are using the above way because nightwatch.js Keys does not have any alphabet command in its array, I have consoled and I haven't found any alphabet to press it.
Keys:
{ NULL: '',
CANCEL: '',
HELP: '',
BACK_SPACE: '',
TAB: '',
CLEAR: '',
RETURN: '',
ENTER: '',
SHIFT: '',
CONTROL: '',
ALT: '',
PAUSE: '',
ESCAPE: '',
SPACE: '',
PAGEUP: '',
PAGEDOWN: '',
END: '',
HOME: '',
LEFT_ARROW: '',
UP_ARROW: '',
RIGHT_ARROW: '',
DOWN_ARROW: '',
ARROW_LEFT: '',
ARROW_UP: '',
ARROW_RIGHT: '',
ARROW_DOWN: '',
INSERT: '',
DELETE: '',
SEMICOLON: '',
EQUALS: '',
NUMPAD0: '',
NUMPAD1: '',
NUMPAD2: '',
NUMPAD3: '',
NUMPAD4: '',
NUMPAD5: '',
NUMPAD6: '',
NUMPAD7: '',
NUMPAD8: '',
NUMPAD9: '',
MULTIPLY: '',
ADD: '',
SEPARATOR: '',
SUBTRACT: '',
DECIMAL: '',
DIVIDE: '',
F1: '',
F2: '',
F3: '',
F4: '',
F5: '',
F6: '',
F7: '',
F8: '',
F9: '',
F10: '',
F11: '',
F12: '',
COMMAND: '',
META: ''
},
You can press any key in above array easily like "client.keys(client.Keys.ENTER);".