Python硒选择div

时间:2021-05-19 14:17:54

标签: python python-3.x selenium selenium-webdriver python-3.6

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)

我有问题。
我做 autogenerator acounts discord.mail,password,name 工作。但是对于日期我有问题,因为他们没有输入。请帮帮我

1 个答案:

答案 0 :(得分:0)

要打开选择的月份,您可以使用

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

然后选择一些类似的月份

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

这里的最后一个数字是列表中的选项数。

同样可以选择日期和年份

相关问题