@@ -920,29 +920,33 @@ def copy_to_clipboard(self, text, wait=0):
920920 delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
921921 self .sleep (delay )
922922
923- def tab (self , wait = 0 ):
923+ def tab (self , wait = 0 , presses = 1 ):
924924 """
925925 Press key Tab
926926
927927 Args:
928928 wait (int, optional): Wait interval (ms) after task
929+ presses (int, optional): Number of times to press the key. Defaults to 1.
929930
930931 """
931- self ._kb_controller .tap (Key .tab )
932- delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
933- self .sleep (delay )
932+ for i in range (presses ):
933+ self ._kb_controller .tap (Key .tab )
934+ self .sleep (config .DEFAULT_SLEEP_AFTER_ACTION )
935+ self .sleep (wait )
934936
935- def enter (self , wait = 0 ):
937+ def enter (self , wait = 0 , presses = 1 ):
936938 """
937939 Press key Enter
938940
939941 Args:
940942 wait (int, optional): Wait interval (ms) after task
943+ presses (int, optional): Number of times to press the key. Defaults to 1.
941944
942945 """
943- self ._kb_controller .tap (Key .enter )
944- delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
945- self .sleep (delay )
946+ for i in range (presses ):
947+ self ._kb_controller .tap (Key .enter )
948+ self .sleep (config .DEFAULT_SLEEP_AFTER_ACTION )
949+ self .sleep (wait )
946950
947951 def key_right (self , wait = 0 ):
948952 """
@@ -1310,6 +1314,39 @@ def control_t(self, wait=0):
13101314 delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
13111315 self .sleep (delay )
13121316
1317+ def control_s (self , wait = 0 ):
1318+ """
1319+ Press keys CTRL+S
1320+
1321+ Args:
1322+ wait (int, optional): Wait interval (ms) after task
1323+
1324+ """
1325+ key = Key .ctrl
1326+ if platform .system () == 'Darwin' :
1327+ key = Key .cmd
1328+ with self ._kb_controller .pressed (key ):
1329+ self ._kb_controller .tap ('s' )
1330+ delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
1331+ self .sleep (delay )
1332+
1333+ def control_key (self , key_to_press : str , wait = 0 ):
1334+ """
1335+ Press CTRL and one more simple key to perform a keyboard shortcut
1336+
1337+ Args:
1338+ key_to_press (str): The key that will be pressed with the CTRL.
1339+ wait (int, optional): Wait interval (ms) after task.
1340+
1341+ """
1342+ key = Key .ctrl
1343+ if platform .system () == 'Darwin' :
1344+ key = Key .cmd
1345+ with self ._kb_controller .pressed (key ):
1346+ self ._kb_controller .tap (key_to_press .lower ())
1347+ delay = max (0 , wait or config .DEFAULT_SLEEP_AFTER_ACTION )
1348+ self .sleep (delay )
1349+
13131350 def control_end (self , wait = 0 ):
13141351 """
13151352 Press keys CTRL+End
0 commit comments