Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
修复答题报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
PRaichu committed Jul 24, 2022
1 parent 208891e commit 40a50e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
14 changes: 7 additions & 7 deletions operation/exam.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ def to_exam(browser: XuexiChrome, exam_type: check.CheckResType):
click(browser, daily)
sleep(round(uniform(2, 4), 2))
run_exam(browser)
elif exam_type == check.CheckResType.WEEKLY_EXAM:
weekly = exam[5]
browser.execute_script('arguments[0].scrollIntoView();', weekly)
sleep(round(uniform(1, 2), 2))
click(browser, weekly)
check_exam(browser, exam_type)
elif exam_type == check.CheckResType.SPECIAL_EXAM:
special = exam[6]
special = exam[5]
browser.execute_script('arguments[0].scrollIntoView();', special)
sleep(round(uniform(1, 2), 2))
click(browser, special)
check_exam(browser, exam_type)
elif exam_type == check.CheckResType.WEEKLY_EXAM:
weekly = exam[6]
browser.execute_script('arguments[0].scrollIntoView();', weekly)
sleep(round(uniform(1, 2), 2))
click(browser, weekly)
check_exam(browser, exam_type)


def select_all(options):
Expand Down
15 changes: 9 additions & 6 deletions userOperation/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def check_task(browser: XuexiChrome):
table.add_column("视频数量", justify='center')
table.add_column("视频时长", justify='center')
table.add_column("每日答题", justify='center')
table.add_column("每周答题", justify='center')
table.add_column("专项答题", justify='center')
table.add_column("每周答题", justify='center')
table.add_column("今日累计积分", justify='center')
table.add_column("成长总积分", justify='center')
table_row = []
Expand All @@ -50,6 +50,9 @@ def check_task(browser: XuexiChrome):
browser.xuexi_get('https://www.xuexi.cn/index.html')
browser.xuexi_get('https://pc.xuexi.cn/points/my-points.html')

# 获取各任务项底部按钮
task_buttons = browser.find_elements(by=By.CLASS_NAME, value='big')

# 获取各任务项积分
scores = browser.find_elements(by=By.CLASS_NAME, value='my-points-card-text')
for score in scores:
Expand Down Expand Up @@ -87,14 +90,14 @@ def check_task(browser: XuexiChrome):
return res

day_of_week = str(datetime.now().isoweekday())
if settings['每日答题'] == 'true' and res == CheckResType.NULL and scores[4].text != '5分/5分':
if settings['每日答题'] == 'true' and res == CheckResType.NULL and task_buttons[4].text != '已完成':
if settings['答题时间设置']['是否启用(关闭则每天都答题)'] != 'true' or (settings['答题时间设置']['是否启用(关闭则每天都答题)'] == 'true' and day_of_week in settings['答题时间设置']['答题类型(数字代表星期几)']['每日答题']):
res = CheckResType.DAILY_EXAM
if exam_temp['WEEKLY_EXAM'] == 'true' and settings['每周答题'] == 'true' and res == CheckResType.NULL and scores[5].text != '5分/5分':
if settings['答题时间设置']['是否启用(关闭则每天都答题)'] != 'true' or (settings['答题时间设置']['是否启用(关闭则每天都答题)'] == 'true' and day_of_week in settings['答题时间设置']['答题类型(数字代表星期几)']['每周答题']):
res = CheckResType.WEEKLY_EXAM
if exam_temp['SPECIAL_EXAM'] == 'true' and settings['专项答题'] == 'true' and res == CheckResType.NULL and scores[6].text != '10分/10分':
if exam_temp['SPECIAL_EXAM'] == 'true' and settings['专项答题'] == 'true' and res == CheckResType.NULL and task_buttons[5].text != '已完成':
if settings['答题时间设置']['是否启用(关闭则每天都答题)'] != 'true' or (settings['答题时间设置']['是否启用(关闭则每天都答题)'] == 'true' and day_of_week in settings['答题时间设置']['答题类型(数字代表星期几)']['专项答题']):
res = CheckResType.SPECIAL_EXAM
if exam_temp['WEEKLY_EXAM'] == 'true' and settings['每周答题'] == 'true' and res == CheckResType.NULL and task_buttons[6].text != '已完成':
if settings['答题时间设置']['是否启用(关闭则每天都答题)'] != 'true' or (settings['答题时间设置']['是否启用(关闭则每天都答题)'] == 'true' and day_of_week in settings['答题时间设置']['答题类型(数字代表星期几)']['每周答题']):
res = CheckResType.WEEKLY_EXAM

return res

0 comments on commit 40a50e9

Please sign in to comment.