def score_program_100(self): try: # 论坛打分 while True: if not self.running: break

            if self.paused:
                continue

            blank_message = self.browser.find_elements(By.CLASS_NAME, 'blank-message')
            if blank_message:
                self.update_text_box("该学生未提交作业,不进行打分操作")
                next_student_button = self.browser.find_element(By.CLASS_NAME, 'icon-right-narrow')
                next_student_button.click()
                time.sleep(1.5)
                continue

            score_box = self.browser.find_element(By.CLASS_NAME, 'score-box')
            score_input = score_box.find_element(By.TAG_NAME, 'input')
            score_input.clear()
            score = random.randint(94, 99)
            score_input.send_keys(str(score))
            time.sleep(1.5)
            submit_button = self.browser.find_element(By.CLASS_NAME, 'nav-text')
            submit_button.click()
            time.sleep(2.5)
            self.update_text_box(f"本次题目分值为:{score}")
            if '已到最后' in self.browser.page_source:
                self.update_running_label('已到最后,请手动保存后重新开始!')
                break
            else:
                next_student_button = self.browser.find_element(By.CLASS_NAME, 'icon-right-narrow')
                next_student_button.click()
                time.sleep(1.5)
                self.update_running_label('论坛打分中...')

    except Exception as e:
        print(e)
        self.update_running_label('论坛打分失败,请重试'
def score_program_100self try # 论坛打分 while True if not selfrunning break if selfpaused continue

原文地址: http://www.cveoy.top/t/topic/htkH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录