import pytesseract
from pyfiglet import Figlet
import requests
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
# driver.get('http://www.baidu.com') #vux-x-input-twq0s
# driver.get('file:///Volumes/DATA/python_projects/kz/口罩预约/顺丰预约.html')
# driver.get('file://F:\\PyCharmProjects\\facial-mask-appointment\\口罩预约\\顺丰预约.html')
# driver.get('file://F:\\PyCharmProjects\\facial-mask-appointment\\快递预约2\\快递预约.html')
driver.get('http://kzyynew.qingdao.gov.cn:81/dist/index.html#/preOrder')
# driver.get('http://kzyynew.qingdao.gov.cn:81/dist/index.html#/SFOrder')
link_list = [
{'name': '钟灵',
'tel': '1856130xxx0',
'id_number': '3707251xxxxxxxxxxx5'},
{'name': '钟灵',
'tel': '1856130xxx0',
'id_number': '3707251xxxxxxxxxxx5'},
]
def clear_input(input):
ActionChains(driver).move_to_element(input).send_keys(Keys.CONTROL, "a")
ActionChains(driver).move_to_element(input).send_keys(Keys.DELETE)
def fill_link_data(name, tel, id_number):
try:
check_button = driver.find_element_by_xpath('//*[@id="app"]/div/div/div[3]/div/div/div/i[3]')
check_button.click()
except:
pass
weuis = driver.find_elements_by_xpath("//input")
# 姓名
# print(weuis[0])
weuis[0].clear()
clear_input(weuis[0])
# weuis[0].sendKeys(Keys.CONTROL, "a")
# weuis[0].sendKeys(Keys.DELETE)
weuis[0].send_keys(name)
# 电话
weuis[1].clear()
clear_input(weuis[1])
weuis[1].send_keys(tel)
# 身份证号
weuis[2].clear()
clear_input(weuis[2])
weuis[2].send_keys(id_number)
#
selects = driver.find_elements_by_xpath("//select")
selects[0].send_keys('李沧区')
selects[1].send_keys('浮山路街道办事处')
driver.find_element_by_xpath('//*[@id="app"]/div/div/div[1]/div/div[6]/div[2]/textarea').clear()
driver.find_element_by_xpath('//*[@id="app"]/div/div/div[1]/div/div[6]/div[2]/textarea').send_keys(
'李沧区')