-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_out.py
36 lines (31 loc) · 1.28 KB
/
log_out.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
from routine import Routine
from routine import RoutineException
from __init__ import *
import pyautogui
class LogOut(Routine):
def execute(self) -> int:
location = self._disablePauseFor_(
lambda: pyautogui.locateCenterOnScreen(logout, confidence=0.99)
)
if (location == None):
raise RoutineException("Could not find the logout button")
for i in range(Routine._command_retries_):
pyautogui.click(location)
_location = self._disablePauseFor_(
lambda: pyautogui.locateCenterOnScreen(confirm_logout, confidence=0.90)
)
if (_location != None):
location = _location
break
elif(i == Routine._command_retries_ - 1):
raise RoutineException("Could not click the logout button")
for i in range(Routine._command_retries_):
pyautogui.click(location)
_location = self._disablePauseFor_(
lambda: pyautogui.locateOnScreen(confirm_logout, confidence = 0.9)
)
if (_location == None):
break
elif(i == Routine._command_retries_ - 1):
raise RoutineException("Could not click the logout confirm button")
return 0