[FIX] script selenium: simplify connexion button click at login

This commit is contained in:
Mathieu Benoit 2025-01-22 03:09:46 -05:00
parent 1da2d17441
commit 7de033f389

View file

@ -34,18 +34,24 @@ def run(config, selenium_tool):
# Trouvez les éléments du formulaire # Trouvez les éléments du formulaire
courriel_input = selenium_tool.driver.find_element(By.NAME, "login") courriel_input = selenium_tool.driver.find_element(By.NAME, "login")
mot_de_passe_input = selenium_tool.driver.find_element(By.NAME, "password") mot_de_passe_input = selenium_tool.driver.find_element(By.NAME, "password")
try: div_connexion_button = selenium_tool.driver.find_element(
connexion_button = selenium_tool.driver.find_element( By.CLASS_NAME, "oe_login_buttons"
By.XPATH, )
"/html/body/div/div/div/form/div[3]/button", connexion_button = div_connexion_button.find_element(
# '//button[contains(text(), "Log in")]' By.CLASS_NAME, "btn-primary"
) )
except Exception: # try:
connexion_button = selenium_tool.driver.find_element( # connexion_button = selenium_tool.driver.find_element(
By.XPATH, # By.XPATH,
"/html/body/div/main/div/form/div[3]/button", # "/html/body/div/div/div/form/div[3]/button",
# '//button[contains(text(), "Connexion")]' # # '//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 # Remplissez le courriel et le mot de passe
courriel_input.send_keys(config.default_email_auth) courriel_input.send_keys(config.default_email_auth)