From 52bfb2f526cd93da115a790843b4952db0a9a327 Mon Sep 17 00:00:00 2001 From: Pyhtagodzilla <1670671958@qq.com> Date: Wed, 25 Jun 2025 21:45:36 +0800 Subject: [PATCH] This time, I don't know why I can't click the button that I could click it before. So I change the way to click the button to use JavaScript to click. --- Authtication.py | 4 +++- run.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Authtication.py b/Authtication.py index e07bb18..0de0f9a 100644 --- a/Authtication.py +++ b/Authtication.py @@ -73,7 +73,9 @@ class BUCTAU: try: driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[2]/input').send_keys(self.USER_USERNAME) driver.find_element(By.XPATH, '//*[@id="password"]').send_keys(self.USER_PASSWORD) - driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[8]/button[1]').click() + login_button = driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[8]/button[1]') + driver.execute_script("arguments[0].click();", login_button) + # driver.find_element(By.ID,"login-account").click() return True except selenium.common.exceptions.NoSuchElementException as e: logging.info("NoSuchElementException: ", e) diff --git a/run.py b/run.py index 258aacd..e30990f 100644 --- a/run.py +++ b/run.py @@ -5,7 +5,7 @@ from Authtication import BUCTAU def main(): """Main function to run the script.""" authenticator = BUCTAU() - driver = authenticator.init_driver_chrome() + driver = authenticator.init_driver_edge() past_time = time.time() while True: if time.time() - past_time > 10.0: