from selenium importwebdriverimporttimeimportrandomdefrun():
browser=webdriver.Chrome()
browser.get("网址")#1
js = "document.getElementById(\"q1\").click()"browser.execute_script(js)
browser.switch_to.frame("__calendarIframe")
js2= "document.getElementById(\"selectTodayButton\").click()"browser.execute_script(js2)
browser.switch_to.parent_frame()#2
js = "document.getElementById(\"q2\").click()"browser.execute_script(js)
browser.switch_to.frame("__calendarIframe")
js2= "document.getElementById(\"selectTodayButton\").click()"browser.execute_script(js2)
browser.switch_to.parent_frame()#3
js = "document.getElementById(\"q3_1\").click()"browser.execute_script(js)#4
browser.find_element_by_id("q4").send_keys("学号")#5
browser.find_element_by_id("q5").send_keys("姓名")#6
js = "document.getElementById(\"q6_1\").click()"browser.execute_script(js)#7
js = "document.getElementById(\"q7_3\").click()"browser.execute_script(js)#8
js = "document.getElementById(\"q8_1\").click()"browser.execute_script(js)
browser.find_element_by_class_name("underline").send_keys("第一次1月9日阴性")#9
js = "document.getElementById(\"q9_2\").click()"browser.execute_script(js)#10
js = "document.getElementById(\"q10_2\").click()"browser.execute_script(js)#11
js = "document.getElementById(\"q12_2\").click()"browser.execute_script(js)#12
browser.find_element_by_id("q14").send_keys("36."+str(random.randint(0,5))+"/36."+str(random.randint(0,5)))#13
js = "document.getElementById(\"q15_2\").click()"browser.execute_script(js)#14
js = "document.getElementById(\"q17_2\").click()"browser.execute_script(js)#15
browser.find_element_by_id("q19").click()
time.sleep(1)
browser.switch_to.frame("PDF_i_chezchenz")
browser.find_element_by_id("txtInput").send_keys("地址")
js3="document.getElementById(\"btnSearch\").click()"browser.execute_script(js3)
time.sleep(1)
browser.find_element_by_css_selector("a.ensure_btn").click()
time.sleep(1)
browser.switch_to.default_content()#16
js = "document.getElementById(\"q20_2\").click()"browser.execute_script(js)#17
browser.find_element_by_id("q22").send_keys("无")#18
browser.find_element_by_id('select2-q23-container').click()#js = "document.getElementById('select2-q23-container').click()"
#browser.execute_script(js)
browser.find_element_by_xpath("//li[@class='select2-results__option'][1]").click()#js = "document.getElementById(\"select2-q23-result-ei9q-1\").click()"
#browser.execute_script(js)
#submit
js = "document.getElementById(\"submit_button\").click()"browser.execute_script(js)if __name__ == "__main__":whileTrue:
run()
time.sleep(4)break