# 点击请假类型(激活下拉框)
driver.find_element_by_class_name('ant-select-selection__placeholder').click()
time.sleep(1)
# 生产随机数
key = random.randrange(1, 5)
# 根据随机数选择下拉框
if key == 1:
    self.param.find_element_by_xpath('//*[@class="ant-select-dropdown-menu-item"][1]').click()
elif key == 2:
     self.param.find_element_by_xpath('//*[@class="ant-select-dropdown-menu-item"][2]').click()
elif key == 3:
     self.param.find_element_by_xpath('//*[@class="ant-select-dropdown-menu-item"][3]').click()
elif key == 4:
     self.param.find_element_by_xpath('//*[@class="ant-select-dropdown-menu-item"][4]').click()
else:
     print('error')

2、定位时间控件

2.1.如图,要选择2号:

查看html源码结构:

可提出该元素的XPATH为:

//*[@class='ant-calendar-tbody']/tr/td[4]

2.2.选择时间

查看html源码结构:

可提出该元素的XPATH为:(选择09:00)

//*[@class='ant-calendar-time-picker-combobox']/div/ul/li[11]
//*[@class='ant-calendar-time-picker-combobox']/div[2]/ul/li

这里有个问题,选择09点后无法点击00分

经手工验证,鼠标移到分的一列后可选择。

解决办法:将鼠标移到分的一列

pyautogui.moveTo(669, 560)