test in an instance of ldtpd.Core
test.generatekeyevent('') # Not working
test.keypress('') # Not working
test.generatekeyevent('abc') # Caps lock not working
test.keyrelease('') # Not working
Is this something I need to fix in ATOMac or is this an LDTP issue?
This is ATOMac issue and not LDTP. Thanks
Can you post an example of the ATOMac code that's not working?
I have an example that isn't working for me
generatekeyevent(COMMAND + DOWN)
The error message says to "Please provide only one character to send" - line 370 of AXClasses
Saw this from LDTP forum - http://ldtp.myfastforum.org/viewtopic.php?p=273#273
I was able to get around with by using osascript
cmd = "osascript -e \'tell application \"System Events\" to keystroke \"" + myString + "\"'"
Fix for not working key combos (Issue #43).
ldtp.keypress and ldtp.keyrelease appear to be completely broken in atomac.
Sample code segments:
1: ldtp.keypress('<shift>'); ldtp.keypress('a'); ldtp.keyrelease('a'); ldtp.keyrelease('<shift>')
2: ldtp.keypress('<shift>'); ldtp.generatekeyevent('a'); ldtp.keyrelease('<shift>')
On both Windows and Linux, running either of the above scripts from an interactive Python console will type an uppercase A in the currently active window (which is generally the console itself).
On my Mac test system, however, script 1 throws an "Unsupported modifiers" exception, and script 2 types a lowercase "a".
Closer inspection of keypress_actions.py reveals that both KeyPressAction and KeyReleaseAction (which are triggered from keypress and keyrelease) do nothing but attempt to press/release the modifier keys*, throwing an exception for any keys not having modifiers. On Windows and Linux, these functions work with any keys, not just modifiers (e.g. for interacting with a game which uses WASD for movement).
Furthermore, they don't even appear to be working when they are only given modifiers, as demonstrated by the second code sample (which should print an uppercase A because the shift key is supposed to be pressed).