Skip to content

Commit 4341867

Browse files
committed
Add "self.get_totp_code()" (shorter version of Google Auth)
1 parent cc0749b commit 4341867

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

help_docs/method_summary.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ self.get_chromedriver_version()
402402

403403
self.is_chromedriver_too_old()
404404

405-
self.get_google_auth_password(totp_key=None)
405+
self.get_totp_code(totp_key=None)
406+
# Duplicates: self.get_google_auth_password(totp_key=None)
407+
# self.get_google_auth_code(totp_key=None)
406408

407409
self.convert_css_to_xpath(css)
408410

seleniumbase/fixtures/base_case.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5195,12 +5195,12 @@ def is_chromedriver_too_old(self):
51955195
return True # chromedriver is too old! Please upgrade!
51965196
return False
51975197

5198-
def get_google_auth_password(self, totp_key=None):
5198+
def get_totp_code(self, totp_key=None):
51995199
"""Returns a time-based one-time password based on the
5200-
Google Authenticator password algorithm. Works with Authy.
5201-
If "totp_key" is not specified, defaults to using the one
5202-
provided in seleniumbase/config/settings.py
5203-
Google Auth passwords expire and change at 30-second intervals.
5200+
Google Authenticator algorithm. Works with Authy and Okta.
5201+
If the "totp_key" is not specified, this method defaults
5202+
to using the one provided in [seleniumbase/config/settings.py].
5203+
Google Authenticator codes expire & change at 30-sec intervals.
52045204
If the fetched password expires in the next 1.5 seconds, waits
52055205
for a new one before returning it (may take up to 1.5 seconds).
52065206
See https://pyotp.readthedocs.io/en/latest/ for details."""
@@ -6163,6 +6163,14 @@ def assert_element_not_present(
61636163
self.wait_for_element_absent(selector, by=by, timeout=timeout)
61646164
return True
61656165

6166+
def get_google_auth_password(self, totp_key=None):
6167+
""" Same as self.get_totp_code() """
6168+
return self.get_totp_code(totp_key=totp_key)
6169+
6170+
def get_google_auth_code(self, totp_key=None):
6171+
""" Same as self.get_totp_code() """
6172+
return self.get_totp_code(totp_key=totp_key)
6173+
61666174
def assert_no_broken_links(self, multithreaded=True):
61676175
""" Same as self.assert_no_404_errors() """
61686176
self.assert_no_404_errors(multithreaded=multithreaded)

0 commit comments

Comments
 (0)