1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| from selenium import webdriver import time import random
def run(): browser = webdriver.Edge(executable_path='msedgedriver.exe') browser.get("https://www.wjx.cn/jq/80378706.aspx")
randomId = random.randint(1, 2) js = "document.getElementById(\"q1_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 4) js = "document.getElementById(\"q2_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
block = ["商学院", "计科院", "电气院"] randomId = random.randint(0, 2) browser.find_element_by_id("q3").send_keys(block[randomId]) time.sleep(1)
block = ["会计", "网工", "电气"] browser.find_element_by_id("q4").send_keys(block[randomId]) time.sleep(1)
randomId = random.randint(1, 5) for i in range(1, randomId + 1): randomId1 = random.randint(1, 5) js = "document.getElementById(\"q5_" + str(randomId1) + "\").checked = true" browser.execute_script(js) js = "document.getElementById(\"q5_" + str(randomId1) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 3) for i in range(1, randomId + 1): randomId1 = random.randint(1, 3) js = "document.getElementById(\"q6_" + str(randomId1) + "\").checked = true" browser.execute_script(js) js = "document.getElementById(\"q6_" + str(randomId1) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 3) for i in range(1, randomId + 1): randomId1 = random.randint(1, 3) js = "document.getElementById(\"q7_" + str(randomId1) + "\").checked = true" browser.execute_script(js) js = "document.getElementById(\"q7_" + str(randomId1) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 2) js = "document.getElementById(\"q8_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 2) js = "document.getElementById(\"q9_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 3) js = "document.getElementById(\"q10_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
if randomId == 2: randomId2 = random.randint(1, 6) for i in range(1, randomId2 + 1): randomId1 = random.randint(1, 6) js = "document.getElementById(\"q12_" + str(randomId1) + "\").checked = true" browser.execute_script(js) js = "document.getElementById(\"q12_" + str(randomId1) + "\").click()" browser.execute_script(js) time.sleep(1) else: randomId2 = random.randint(1, 7) for i in range(1, randomId2 + 1): randomId1 = random.randint(1, 7) js = "document.getElementById(\"q11_" + str(randomId1) + "\").checked = true" browser.execute_script(js) js = "document.getElementById(\"q11_" + str(randomId1) + "\").click()" browser.execute_script(js) time.sleep(1)
randomId = random.randint(1, 3) js = "document.getElementById(\"q13_" + str(randomId) + "\").click()" browser.execute_script(js) time.sleep(1)
block = ["线上教学太生硬", "线上教学不太好", "没有不足之处,挺好的"] randomId = random.randint(0, 2) browser.find_element_by_id("q14").send_keys(block[randomId]) time.sleep(1)
block = ["希望作业能多一点", "如果可以,希望老师能讲课讲清楚一些", "建议取消线上考试"] randomId = random.randint(0, 2) browser.find_element_by_id("q15").send_keys(block[randomId]) time.sleep(1)
js = "document.getElementById(\"submit_button\").click()" browser.execute_script(js)
browser.quit()
if __name__ == "__main__": while True: run() time.sleep(10)
|