-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_automate_calculator.py
43 lines (35 loc) · 1.24 KB
/
test_automate_calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pyautogui, time
pauseSeconds = 0.3
# Open Windows Calculator via CLI
pyautogui.hotkey('winleft', 'r')
pyautogui.typewrite('calc', pause=pauseSeconds)
pyautogui.press('enter', pause=pauseSeconds)
# Wait for the Calculator: 2 Seconds
time.sleep(2)
# Addition
pyautogui.press('escape', pause=pauseSeconds)
pyautogui.press('7', pause=pauseSeconds)
pyautogui.press('+', pause=pauseSeconds)
pyautogui.press('3', pause=pauseSeconds)
pyautogui.press('enter', pause=pauseSeconds)
# Subtraction
pyautogui.press('escape', pause=pauseSeconds)
pyautogui.press('7', pause=pauseSeconds)
pyautogui.press('-', pause=pauseSeconds)
pyautogui.press('3', pause=pauseSeconds)
pyautogui.press('enter', pause=pauseSeconds)
# Multiplication
pyautogui.press('escape', pause=pauseSeconds)
pyautogui.press('7', pause=pauseSeconds)
pyautogui.press('*', pause=pauseSeconds)
pyautogui.press('3', pause=pauseSeconds)
pyautogui.press('enter', pause=pauseSeconds)
# Division
pyautogui.press('escape', pause=pauseSeconds)
pyautogui.press('7', pause=pauseSeconds)
pyautogui.press('/', pause=pauseSeconds)
pyautogui.press('3', pause=pauseSeconds)
pyautogui.press('enter', pause=pauseSeconds)
# Close Calculator
pyautogui.press('escape', pause=pauseSeconds)
pyautogui.hotkey('alt', 'f4')