selenium日历框处理
参考:
https://blog.csdn.net/amric1212/article/details/85103989
https://blog.csdn.net/qq_36051316/article/details/83472659
https://blog.csdn.net/lilongsy/article/details/80242427
UI自动化中,新增限时特惠需要选择日期范围
#日历
begin_date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
end_date = time.strftime('%Y-%m-%d', time.localtime(time.time()+ 86400*7))
#print(end_date)
# 开始时间输入当前日期
self.driver.find_element_by_xpath(
'//*[@id="app"]/div/div[2]/section/div/div[2]/div/div[2]/form/div[3]/div/div/input[1]').send_keys(
begin_date)
time.sleep(1)
# 结束时间输入7天后
self.driver.find_element_by_xpath(
'//*[@id="app"]/div/div[2]/section/div/div[2]/div/div[2]/form/div[3]/div/div/input[2]').send_keys(
end_date)
# 点击其他地方收起日历框
self.driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/section/div/div[2]/div/div[1]/span').click()