MCPcopy
hub / github.com/ocsjs/ocsjs / handleVideoTest

Function handleVideoTest

packages/scripts/src/projects/icourse.ts:157–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155 * 处理视频弹窗题目
156 */
157 const handleVideoTest = async () => {
158 if (!canRun() || job_id !== state.current_job_id) return;
159 setTimeout(async () => {
160 const question = document.querySelector('.u-questionItem');
161 const media = document.querySelector('video,audio');
162 if (question && media) {
163 $msg_and_log('info', '检测到视频弹窗测验,开始答题');
164 await new Promise<void>((resolve) => {
165 ICourseProject.scripts.work.methods.start('chapter-test', canRun, (worker) => {
166 console.log('worker', worker);
167 worker.once('done', resolve);
168 worker.once('close', resolve);
169 worker.once('stop', resolve);
170 });
171 });
172 await $.sleep(1000);
173 // 点击继续学习
174 await remotePage.click('.j-unitctBox .u-btn-default.j-continue');
175 $msg_and_log('info', '测验完成');
176 }
177 handleVideoTest();
178 }, 3000);
179 };
180 handleVideoTest();
181
182 const study = async () => {

Callers 1

methodsFunction · 0.85

Calls 2

canRunFunction · 0.85
$msg_and_logFunction · 0.70

Tested by

no test coverage detected