From 3b9d1bb00418c19aa35b40dd19421b721bdd27d8 Mon Sep 17 00:00:00 2001 From: jmac774 <104130511+jmac774@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:56:51 +0200 Subject: [PATCH] Handles case of grace period for registering MFA Handles case when user is required to register for MFA (<14 days grace period) but is not registered yet. We click the "Ask me later" button to skip registration. --- roadtx/roadtools/roadtx/selenium.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roadtx/roadtools/roadtx/selenium.py b/roadtx/roadtools/roadtx/selenium.py index a00834f4..7dbb9840 100644 --- a/roadtx/roadtools/roadtx/selenium.py +++ b/roadtx/roadtools/roadtx/selenium.py @@ -160,6 +160,16 @@ def selenium_login(self, url, identity=None, password=None, otpseed=None, keep=F els = WebDriverWait(driver, 6000).until(lambda d: d.find_element(By.ID, "i0118")) els.send_keys(Keys.ENTER) + try: + # handle case with "Action Required" + # happens when user is not registered with MFA yet and has XX days until required + els = WebDriverWait(driver, 2).until(lambda d: d.find_element(By.ID, 'txtSkipMfaRegistration')) + print(f"MFA will be enforced for this account: {els.text} (skipping now)") + els = WebDriverWait(driver, 2).until(lambda d: d.find_element(By.ID, 'btnAskLater')) + els.click() + except TimeoutException: + pass + # Quick check of mfa not needed try: WebDriverWait(driver, 2).until(lambda d: '?code=' in d.current_url)