More checks on TFA

This commit is contained in:
augustin64
2024-04-10 12:14:41 +02:00
parent 1a8137783c
commit 52e88f81b9
3 changed files with 16 additions and 9 deletions

View File

@ -30,7 +30,8 @@ class UserCredentials:
def get_tfa(self):
if not self.tfa_enable():
warning("Warning: TFA is not enabled. Calling get_tfa is an expected behaviour.")
warning("Warning: TFA is not enabled. Can't get a TFA code.")
return None
return TOTP(self.data[self.current]["2fa"])
def next_account(self):

View File

@ -71,11 +71,12 @@ def send_wait_and_confirm(element, keys: str) -> None:
# Wait for the presence of the element identifier or [timeout]s
def wait_until_visible(search_by: str, identifier: str, timeout: int = 20, browser=None) -> bool:
def wait_until_visible(search_by: str, identifier: str, timeout: int = 20, browser=None, raise_error=True) -> bool:
try:
WebDriverWait(browser, timeout).until(
expected_conditions.visibility_of_element_located((search_by, identifier)), "element not found")
return True
except TimeoutException as e:
error(f"element {identifier} not found after {timeout}s")
if raise_error:
error(f"element {identifier} not found after {timeout}s")
return False