mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-06-17 17:14:46 +02:00
More checks on TFA
This commit is contained in:
@ -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):
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user