(cookies, scores)
| 160 | |
| 161 | |
| 162 | def weekly(cookies, scores): |
| 163 | if scores["weekly"] < const.weekly_all: |
| 164 | # driver_weekly = Mydriver(nohead=nohead) time.sleep(random.randint(5, 15)) |
| 165 | driver_weekly = Mydriver(nohead=False) |
| 166 | driver_weekly.driver.maximize_window() |
| 167 | print('请保持窗口最大化') |
| 168 | print('请保持窗口最大化') |
| 169 | print('请保持窗口最大化') |
| 170 | driver_weekly.get_url("https://www.xuexi.cn/notFound.html") |
| 171 | driver_weekly.set_cookies(cookies) |
| 172 | try_count = 0 |
| 173 | |
| 174 | if scores["weekly"] < const.weekly_all: |
| 175 | letters = list("ABCDEFGHIJKLMN") |
| 176 | driver_weekly.get_url('https://pc.xuexi.cn/points/my-points.html') |
| 177 | driver_weekly.click_xpath('//*[@id="app"]/div/div[2]/div/div[3]/div[2]/div[6]/div[2]/div[2]/div') |
| 178 | time.sleep(2) |
| 179 | # <<<<<<< fix-some-bugs |
| 180 | # flag = 1 |
| 181 | # for tem in range(0, 40): |
| 182 | # for tem2 in range(0, 5): |
| 183 | # try: |
| 184 | # temword = driver_weekly.driver.find_element_by_xpath( |
| 185 | # '//*[@id="app"]/div/div[2]/div/div[4]/div/div[' + str(tem + 1) + ']/div[2]/div[' + str( |
| 186 | # tem2 + 1) + ']/button').text |
| 187 | # except: |
| 188 | # temword = '' |
| 189 | # name_list = ["开始答题", "继续答题"] |
| 190 | # if flag == 1 and (any(name in temword for name in name_list)): |
| 191 | # driver_weekly.click_xpath( |
| 192 | # '//*[@id="app"]/div/div[2]/div/div[4]/div/div[' + str(tem + 1) + ']/div[2]/div[' + str( |
| 193 | # tem2 + 1) + ']/button') |
| 194 | # flag = 0 |
| 195 | dati = driver_weekly.driver.find_elements_by_css_selector("#app .month .week button") |
| 196 | toclick = dati |
| 197 | for i in range(len(dati)-1,-1,-1): |
| 198 | j = dati[i] |
| 199 | if ("重新" in j.text or "满分" in j.text): |
| 200 | continue |
| 201 | else: |
| 202 | toclick = j |
| 203 | toclick.click() |
| 204 | break |
| 205 | while scores["weekly"] < const.weekly_all and try_count < 10: |
| 206 | # ''' |
| 207 | # ======= |
| 208 | # flag = 1 |
| 209 | # page_num = 1 |
| 210 | # last_page = int(driver_weekly.driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/div/div[5]/ul/li[last()-1]/a').text) |
| 211 | # while page_num < last_page and flag == 1: |
| 212 | # print('进入每周答题第'+ str(page_num) +'页') |
| 213 | # all_month = len(driver_weekly.driver.find_elements_by_class_name('month')) |
| 214 | # cur_month = 1 |
| 215 | # for tem in range(0, all_month): |
| 216 | # for tem2 in range(0, 6): |
| 217 | # if flag == 0: |
| 218 | # break |
| 219 | # try: |
nothing calls this directly
no test coverage detected