@@ -1313,15 +1313,16 @@ def key_info(self, key):
13131313 info ['text' ] = definition ['text' ]
13141314 return info
13151315
1316- def key_down (self , key ):
1316+ def key_down (self , key , modifier ):
13171317 """Press down a key"""
13181318 info = self .key_info (key )
13191319 params = {
13201320 'type' : 'rawKeyDown' ,
13211321 'key' : info ['key' ],
13221322 'windowsVirtualKeyCode' : info ['keyCode' ],
13231323 'code' : info ['code' ],
1324- 'location' : info ['location' ]
1324+ 'location' : info ['location' ],
1325+ 'modifiers' : modifier
13251326 }
13261327 if 'text' in info :
13271328 params ['type' ] = 'keyDown'
@@ -1331,22 +1332,23 @@ def key_down(self, key):
13311332 params ['isKeypad' ] = True
13321333 self .send_command ('Input.dispatchKeyEvent' , params )
13331334
1334- def key_up (self , key ):
1335+ def key_up (self , key , modifier ):
13351336 """Let up a key"""
13361337 info = self .key_info (key )
13371338 self .send_command ('Input.dispatchKeyEvent' , {
13381339 'type' : 'keyUp' ,
13391340 'key' : info ['key' ],
13401341 'windowsVirtualKeyCode' : info ['keyCode' ],
13411342 'code' : info ['code' ],
1342- 'location' : info ['location' ]
1343+ 'location' : info ['location' ],
1344+ 'modifiers' : modifier
13431345 })
13441346
1345- def keypress (self , key ):
1347+ def keypress (self , key , modifier ):
13461348 """Simulate pressing a keyboard key"""
13471349 try :
1348- self .key_down (key )
1349- self .key_up (key )
1350+ self .key_down (key , modifier )
1351+ self .key_up (key , modifier )
13501352 except Exception :
13511353 logging .exception ('Error running keypress command' )
13521354
@@ -1355,7 +1357,7 @@ def type_text(self, string):
13551357 try :
13561358 for char in string :
13571359 if char in self .key_definitions :
1358- self .keypress (char )
1360+ self .keypress (char , 0 )
13591361 else :
13601362 self .send_character (char )
13611363 except Exception :
0 commit comments