def checkgooglemail(): if "(1366, 768)" in screensizeout: print("success screensize is correct, using folder 1366x768 for locateonscreen function") gmailloggedin = ('1366x768/gmailalreadyloggedin.png') gmailneedpass = ('1366x768/gmailhi.png') gmailfulllogin = ('1366x768/gmailforgot.png') webbrowser.open("https://gmail.com") logging.info('Opening Gmail.com in browser'); gmailalreadyloggedin = pyautogui.locateCenterOnScreen(gmailloggedin) if gmailalreadyloggedin is not None: logging.info('User is already logged in, opening inbox'); print("You were already logged in, so inbox should be opened by browser") gmailhi = pyautogui.locateCenterOnScreen(gmailneedpass) if gmailhi is not None: logging.info('User account is presented, but password needed to login, trying to login with password given'); pyautogui.typewrite(returnedpass) pyautogui.press('enter') gmailforgot = pyautogui.locateCenterOnScreen(gmailfulllogin) if gmailforgot is not None: logging.info('User is not logged in, and no stored accout present, attempting full login with details given'); print(str(gmailforgot) + "This is gmailforgot") pyautogui.typewrite(returned) pyautogui.press('enter') automateitcommon.wait() pyautogui.typewrite(returnedpass) pyautogui.press('enter')
def checkmailru(): # function to check mailru email if "(1366, 768)" in screensizeout: print(cwd) print("success screensize is correct, using folder 1366x768 for locateonscreen function") mailruinbox = (cwd + '/1366x768/ruinbox.png') webbrowser.open("https://e.mail.ru/login?from=mail.login") logging.info('Mail.ru has been opened, checking to see if user is logged in or not'); automateitcommon.wait() ruinbox = pyautogui.locateCenterOnScreen(mailruinbox) if ruinbox is not None: logging.info('User is logged in, opening inbox'); pyautogui.click(ruinbox) if ruinbox is None: logging.info('User is not logged in, attempting to log user in'); automateitcommon.wait() automateitcommon.wait() pyautogui.typewrite(returned) automateitcommon.wait() automateitcommon.onetab() pyautogui.typewrite(returnedpass) automateitcommon.wait() pyautogui.press('enter')