Python Selenium select div

Question:

driver = webdriver.Chrome()
driver.get("https://discord.com/register")

driver.find_element_by_xpath("//input[@class='inputDefault-_djjkz input-cIJ7To' and @type='email']").send_keys(mail)
driver.find_element_by_xpath("//input[@class='inputDefault-_djjkz input-cIJ7To' and @type='text']").send_keys(name)
driver.find_element_by_xpath("//input[@class='inputDefault-_djjkz input-cIJ7To' and @type='password']").send_keys(name)

I have a problem.

I do autogenerator accounts and discord.mail,password,name work. But with a date, I have problems because they don’t have input. How can I do it?

Answers:

To open select Month, you can use:

driver.find_element_by_xpath("//div[contains(@class,'inputMonth')]").click()

Then select some month with something like

driver.find_element_by_xpath("//div[@id='react-select-5-option-1']").click()

The last number here is the number of options in the list.

Similarly, you can select the Day and Year.

Answered By: Prophet