Comment se connecter avec Selenium Webdriver

Sep 11 2020

Bonjour, j'essaye de me connecter automatiquement avec webdriver à cette page Web: https://www.oddsportal.com/login/

Voici mon script:

#!/usr/bin/python3
# -*- coding: utf­-8 ­-*-

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from concurrent.futures import ThreadPoolExecutor

import pandas as pd

options = Options()
#options.headless = True
options.add_argument("window-size=1400,800")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("start-maximized")
options.add_argument("enable-automation")
options.add_argument("--disable-infobars")
options.add_argument("--disable-dev-shm-usage")

driver = webdriver.Chrome(options=options)

driver.get("https://www.oddsportal.com/login/")

driver.find_element_by_id("login-username1").send_keys("ahmedaao")
driver.find_element_by_id("login-password1").send_keys("password")
driver.find_element_by_name("login-submit").click()

J'ai un problème avec la dernière ligne de code. La page Web s'ouvre, puis le nom d'utilisateur et le mot de passe sont facturés, mais je ne suis pas connecté.

Réponses

ahmedaao Sep 12 2020 at 19:06

Je trouve la solution:

driver.find_element_by_xpath('//button[@type="submit"]').click()