This commit is contained in:
dengqichen 2025-11-16 22:49:54 +08:00
parent 95572cb6e1
commit 569a5d2a0f

View File

@ -34,6 +34,7 @@ class WindsurfRegister {
{ id: 1, name: '填写基本信息', method: 'step1_fillBasicInfo' },
{ id: 2, name: '设置密码', method: 'step2_setPassword' },
{ id: 3, name: '邮箱验证', method: 'step3_emailVerification' },
{ id: 4, name: '跳过问卷', method: 'step4_skipSurvey' },
// 根据实际注册流程继续添加
];
}
@ -562,6 +563,52 @@ class WindsurfRegister {
}
}
/**
* 步骤4: 跳过问卷调查
*/
async step4_skipSurvey() {
logger.info(this.siteName, `[步骤 4/${this.getTotalSteps()}] 跳过问卷`);
try {
// 等待页面加载
await this.human.readPage(2, 3);
// 查找并点击"Skip this step"按钮
logger.info(this.siteName, ' → 查找"Skip this step"按钮...');
// 方式1: 通过button文本查找
const buttons = await this.page.$$('button');
let skipButton = null;
for (const button of buttons) {
const text = await this.page.evaluate(el => el.textContent?.trim(), button);
if (text && text.toLowerCase().includes('skip')) {
skipButton = button;
logger.info(this.siteName, ` → 找到按钮: "${text}"`);
break;
}
}
if (skipButton) {
logger.info(this.siteName, ' → 点击"Skip this step"按钮...');
await skipButton.click();
// 等待页面跳转
await this.human.randomDelay(2000, 3000);
this.currentStep = 4;
logger.success(this.siteName, `步骤 4 完成`);
} else {
logger.warn(this.siteName, ' → 未找到Skip按钮可能已跳过此页面');
this.currentStep = 4;
}
} catch (error) {
logger.error(this.siteName, `跳过问卷失败: ${error.message}`);
throw error;
}
}
/**
* 执行注册流程
* @param {Object} options - 选项