From 897fff335f39270d1631cbb375e41717235e9fec Mon Sep 17 00:00:00 2001 From: ray1025 <49980364+ray1025@users.noreply.github.com> Date: Fri, 17 May 2024 17:16:31 +0800 Subject: [PATCH] Fix 2FA --- noip-renew.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/noip-renew.py b/noip-renew.py index 6cc160c..df01919 100755 --- a/noip-renew.py +++ b/noip-renew.py @@ -15,6 +15,7 @@ from selenium import webdriver from selenium.common.exceptions import TimeoutException +from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait @@ -111,9 +112,9 @@ def login(self): self.logger.log("Sending OTP...") ele_challenge = elem.find_element(By.NAME, "challenge_code") - - ele_challenge.send_keys(TOTP(self.totp_secret).now()) - ele_challenge.send_keys(Keys.ENTER) + self.browser.execute_script("arguments[0].focus();", ele_challenge) + ActionChains(self.browser).send_keys(TOTP(self.totp_secret).now()).perform() + ActionChains(self.browser).send_keys(Keys.ENTER).perform() # After Loggin browser loads my.noip.com page - give him some time to load # 'noip-cart' element is near the end of html, so html have been loaded