add key down key up
This commit is contained in:
@@ -18,7 +18,9 @@ class Action(Enum):
|
||||
MOUSE_UP = 2
|
||||
MOUSE_MOVE = 3
|
||||
KEY = 4
|
||||
TYPE = 5
|
||||
KEY_DOWN = 5
|
||||
KEY_UP = 6
|
||||
TYPE = 7
|
||||
|
||||
VM_TYPE = Literal['ubuntu', 'windows']
|
||||
|
||||
@@ -163,6 +165,12 @@ class DesktopEnv(gym.Env):
|
||||
elif action_type == Action.KEY:
|
||||
key_sequence = ''.join(map(chr, action['key'])) # Convert integer array to string
|
||||
self.keyboard_controller.key(key_sequence)
|
||||
elif action_type == Action.KEY_DOWN:
|
||||
key_sequence = ''.join(map(chr, action['key'])) # Convert integer array to string
|
||||
self.keyboard_controller.key_down(key_sequence)
|
||||
elif action_type == Action.KEY_UP:
|
||||
key_sequence = ''.join(map(chr, action['key'])) # Convert integer array to string
|
||||
self.keyboard_controller.key_up(key_sequence)
|
||||
elif action_type == Action.TYPE:
|
||||
text = ''.join(map(chr, action['text'])) # Convert integer array to string
|
||||
self.keyboard_controller.type(text)
|
||||
|
||||
Reference in New Issue
Block a user