Skip to content
Browse files

Merge pull request #115 from jimevans/sendkeys_fixes

Adding support for NULL key.
  • Loading branch information...
2 parents 714f774 + 1380c87 commit 222458f416b8db09689800b2d1e5ffd83f9c51ef @detro committed Nov 3, 2012
Showing with 18 additions and 14 deletions.
  1. +18 −14 src/inputs.js
View
32 src/inputs.js
@@ -215,22 +215,26 @@ ghostdriver.Inputs = function () {
var key = keys[i];
var actualKey = _translateKey(session, key);
- if (_isModifierKey(key)) {
- if (_isModifierKeyPressed(key)) {
- _keyUp(session, actualKey);
- } else {
- _keyDown(session, actualKey);
- }
+ if (key === '\uE000') {
+ _clearModifierKeys(session);
} else {
- if (_implicitShiftKeys.hasOwnProperty(actualKey)) {
- session.getCurrentWindow().sendEvent("keydown", _translateKey(session, "\uE008"));
- _pressKey(session, actualKey);
- session.getCurrentWindow().sendEvent("keyup", _translateKey(session, "\uE008"));
- } else {
- if ((_currentModifierKeys & _modifierKeyValues.SHIFT) && _shiftKeys.hasOwnProperty(actualKey)) {
- _pressKey(session, _shiftKeys[actualKey]);
+ if (_isModifierKey(key)) {
+ if (_isModifierKeyPressed(key)) {
+ _keyUp(session, actualKey);
} else {
+ _keyDown(session, actualKey);
+ }
+ } else {
+ if (_implicitShiftKeys.hasOwnProperty(actualKey)) {
+ session.getCurrentWindow().sendEvent("keydown", _translateKey(session, "\uE008"));
_pressKey(session, actualKey);
+ session.getCurrentWindow().sendEvent("keyup", _translateKey(session, "\uE008"));
+ } else {
+ if ((_currentModifierKeys & _modifierKeyValues.SHIFT) && _shiftKeys.hasOwnProperty(actualKey)) {
+ _pressKey(session, _shiftKeys[actualKey]);
+ } else {
+ _pressKey(session, actualKey);
+ }
}
}
}
@@ -286,14 +290,14 @@ ghostdriver.Inputs = function () {
},
_keyUp = function (session, key) {
- _keyEvent(session, "keyup", key);
if (key == _translateKey(session, "\uE008")) {
_updateModifierKeys(_modifierKeyValues.SHIFT, false);
} else if (key == _translateKey(session, "\uE009")) {
_updateModifierKeys(_modifierKeyValues.CONTROL, false);
} else if (key == _translateKey(session, "\uE00A")) {
_updateModifierKeys(_modifierKeyValues.ALT, false);
}
+ _keyEvent(session, "keyup", key);
},
_mouseClick = function (session, coords) {

0 comments on commit 222458f

Please sign in to comment.
Something went wrong with that request. Please try again.