Skip to content

Commit

Permalink
fix(script): 修复超星选择题选中的答案被取消的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Sep 4, 2023
1 parent cc84599 commit 808709a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/scripts/src/projects/cx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,12 @@ async function chapterTestTask(

const handler: DefaultWork<any>['handler'] = (type, answer, option, ctx) => {
if (type === 'judgement' || type === 'single' || type === 'multiple') {
if (option?.parentElement?.querySelector('label input')?.getAttribute('checked') === 'checked') {
// 检查是否已经选择
const checked =
option?.parentElement?.querySelector('label input')?.getAttribute('checked') === 'checked' ||
// 适配2023/9月最新版本
option?.parentElement?.getAttribute('aria-checked') === 'true';
if (checked) {
// 跳过
} else {
option?.click();
Expand Down

0 comments on commit 808709a

Please sign in to comment.