Do we have any python code API for login using the TOTP ?
Below is a code snippet. Generates Pyotp and login using selenium
if time.localtime().tm_sec >= 50:
sleep(60 - time.localtime().tm_sec + 1)
totp = pyotp.TOTP(self.totp)
totp = [totp.now](http://totp.now)()
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='first']").send_keys(totp[0])
sleep(1)
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='second']").send_keys(totp[1])
sleep(1)
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='third']").send_keys(totp[2])
sleep(1)
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='fourth']").send_keys(totp[3])
sleep(1)
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='fifth']").send_keys(totp[4])
sleep(1)
self.browser.find_element_by_xpath(
"//form[@id='confirmOtpForm']/div/input[@id='sixth']").send_keys(totp[5])
sleep(1)
self.browser.find_element_by_xpath(
"//button[@id='confirmOtpSubmit']").click()
sleep(5)
Hi, You can use this script: