(cookies, scores)
| 13 | |
| 14 | |
| 15 | def daily(cookies, scores): |
| 16 | if scores["daily"] < const.daily_all: |
| 17 | # driver_daily = Mydriver(nohead=nohead) time.sleep(random.randint(5, 15)) |
| 18 | driver_daily = Mydriver(nohead=False) |
| 19 | driver_daily.driver.maximize_window() |
| 20 | print('请保持窗口最大化') |
| 21 | print('请保持窗口最大化') |
| 22 | print('请保持窗口最大化') |
| 23 | driver_daily.get_url("https://www.xuexi.cn/notFound.html") |
| 24 | driver_daily.set_cookies(cookies) |
| 25 | try_count = 0 |
| 26 | |
| 27 | if scores["daily"] < const.daily_all: |
| 28 | letters = list("ABCDEFGHIJKLMN") |
| 29 | driver_daily.get_url('https://pc.xuexi.cn/points/my-points.html') |
| 30 | driver_daily.click_xpath('//*[@id="app"]/div/div[2]/div/div[3]/div[2]/div[5]/div[2]/div[2]/div') #点击每日答题的去答题按钮 |
| 31 | while scores["daily"] < const.daily_all: |
| 32 | try: |
| 33 | category = driver_daily.xpath_getText( #获取题目类型 |
| 34 | '//*[@id="app"]/div/div[2]/div/div[4]/div[1]/div[1]') # get_attribute("name") |
| 35 | except Exception as e: |
| 36 | print('查找题目类型...查找元素失败!') |
| 37 | break |
| 38 | ans_results = driver_daily.driver.find_elements_by_css_selector(".practice-result .infos .info") |
| 39 | if(len(ans_results) != 0): #已经找到答题结果页面 |
| 40 | print(ans_results[0].get_attribute("innerHTML")) |
| 41 | print(ans_results[0].text) |
| 42 | print(ans_results[2].get_attribute("innerHTML")) |
| 43 | print(ans_results[2].text) |
| 44 | exit(2) |
| 45 | break; |
| 46 | print(category) |
| 47 | log_daily("\n====================") |
| 48 | log_daily(log_timestamp()) |
| 49 | log_daily("【"+category+"】") |
| 50 | log_daily("【题干】") |
| 51 | q_body = driver_daily.driver.find_element_by_css_selector(".q-body") |
| 52 | q_html = q_body.get_attribute('innerHTML') |
| 53 | q_text = q_body.text |
| 54 | print(q_text) |
| 55 | log_daily(q_html) |
| 56 | tips, tip_full_text = driver_daily._view_tips() |
| 57 | log_daily("【提示信息】") |
| 58 | log_daily(str(tips)+"\n"+tip_full_text) |
| 59 | if not tips: |
| 60 | print("本题没有提示") |
| 61 | log_daily("!!!!!本题没有找到提示,暂时略过!!!!!") |
| 62 | if "填空题" in category: |
| 63 | print('没有找到提示,暂时略过') |
| 64 | continue |
| 65 | elif "多选题" in category: |
| 66 | print('没有找到提示,暂时略过') |
| 67 | continue |
| 68 | elif "单选题" in category: |
| 69 | print('没有找到提示,暂时略过') |
| 70 | continue |
| 71 | # return driver_daily._search(driver_daily.content, driver_daily.options, driver_daily.excludes) |
| 72 | else: |
nothing calls this directly
no test coverage detected