From 7de033f389632a2aec6266a1e79f49c8c1a4f071 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 22 Jan 2025 03:09:46 -0500 Subject: [PATCH] [FIX] script selenium: simplify connexion button click at login --- script/selenium/web_login.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/script/selenium/web_login.py b/script/selenium/web_login.py index 0af9509..84ff8ed 100755 --- a/script/selenium/web_login.py +++ b/script/selenium/web_login.py @@ -34,18 +34,24 @@ def run(config, selenium_tool): # Trouvez les éléments du formulaire courriel_input = selenium_tool.driver.find_element(By.NAME, "login") mot_de_passe_input = selenium_tool.driver.find_element(By.NAME, "password") - try: - connexion_button = selenium_tool.driver.find_element( - By.XPATH, - "/html/body/div/div/div/form/div[3]/button", - # '//button[contains(text(), "Log in")]' - ) - except Exception: - connexion_button = selenium_tool.driver.find_element( - By.XPATH, - "/html/body/div/main/div/form/div[3]/button", - # '//button[contains(text(), "Connexion")]' - ) + div_connexion_button = selenium_tool.driver.find_element( + By.CLASS_NAME, "oe_login_buttons" + ) + connexion_button = div_connexion_button.find_element( + By.CLASS_NAME, "btn-primary" + ) + # try: + # connexion_button = selenium_tool.driver.find_element( + # By.XPATH, + # "/html/body/div/div/div/form/div[3]/button", + # # '//button[contains(text(), "Log in")]' + # ) + # except Exception: + # connexion_button = selenium_tool.driver.find_element( + # By.XPATH, + # "/html/body/div/main/div/form/div[3]/button", + # # '//button[contains(text(), "Connexion")]' + # ) # Remplissez le courriel et le mot de passe courriel_input.send_keys(config.default_email_auth)