I'm new to selenium and I'm trying to create a code that automates the creation process of creating a discord accountbut when it come to filling date of birth info I can't get the right class_name of each field . I'm willing to have any help 💕
from typing import KeysViewfrom selenium import webdriverfrom selenium.webdriver.chrome.service import Service as ChromeServicefrom webdriver_manager.chrome import ChromeDriverManagerfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import Selectfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECimport timedef get_month_number_from_name(month_name): month_mapping = {'January': '1','February': '2','March': '3','April': '4','May': '5','June': '6','July': '7','August': '8','September': '9','October': '10','November': '11','December': '12' } return month_mapping[month_name]options = webdriver.ChromeOptions()driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)driver.get('https://discord.com/register') WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='email']"))).send_keys("mo.key1998.1@example.com")WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='global_name']"))).send_keys("Your Display Name")WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='username']"))).send_keys("TheUltimateMoreda")WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='password']"))).send_keys("msafan2006")day_dropdown = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "(.//*[@class='css-19vtg9u-control'])[1]")))day_dropdown.click()day_option = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, ".//*[contains(@id,'react-select-2-option-') and text()='1']")))day_option.click()month = "January"year = "1998"month_dropdown = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "(.//*[@class='css-19vtg9u-control'])[2]")))month_dropdown.click()month_option = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, f".//div[contains(@id,'react-select') and .//div[text()='{get_month_number_from_name(month)}']]")))month_option.click()year_dropdown = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "(.//*[@class='css-19vtg9u-control'])[3]")))year_dropdown.click()year_option = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, f".//*[contains(@id,'react-select-4-option-') and text()='{year}']")))year_option.click()time.sleep(200)driver.quit()
please anyone help on this issue