aaaaa
This commit is contained in:
parent
af26fab852
commit
95572cb6e1
@ -525,30 +525,23 @@ class WindsurfRegister {
|
|||||||
logger.info(this.siteName, ' → 等待按钮激活...');
|
logger.info(this.siteName, ' → 等待按钮激活...');
|
||||||
await this.human.randomDelay(2000, 3000);
|
await this.human.randomDelay(2000, 3000);
|
||||||
|
|
||||||
// 查找"Create account"按钮
|
// 等待按钮激活
|
||||||
try {
|
try {
|
||||||
await this.page.waitForSelector('button:not([disabled])', { timeout: 10000 });
|
await this.page.waitForSelector('button:not([disabled])', { timeout: 10000 });
|
||||||
logger.success(this.siteName, ' → 按钮已激活');
|
logger.success(this.siteName, ' → 按钮已激活');
|
||||||
|
|
||||||
// 点击提交按钮
|
|
||||||
const submitButton = await this.page.$('button[type="submit"]');
|
|
||||||
if (submitButton) {
|
|
||||||
logger.info(this.siteName, ' → 点击"Create account"按钮...');
|
|
||||||
await submitButton.click();
|
|
||||||
} else {
|
|
||||||
// 尝试点击任何未disabled的按钮
|
|
||||||
const anyButton = await this.page.$('button:not([disabled])');
|
|
||||||
if (anyButton) {
|
|
||||||
logger.info(this.siteName, ' → 点击提交按钮...');
|
|
||||||
await anyButton.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(this.siteName, ` → 按钮等待超时,可能已自动提交: ${e.message}`);
|
logger.warn(this.siteName, ` → 按钮等待超时: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 等待页面跳转或验证完成
|
// 点击按钮并等待页面跳转
|
||||||
await this.human.randomDelay(3000, 5000);
|
const checkPageChanged = async () => {
|
||||||
|
// 检查是否离开了验证码页面(URL改变或页面元素改变)
|
||||||
|
const currentUrl = this.page.url();
|
||||||
|
return !currentUrl.includes('/register') ||
|
||||||
|
await this.page.$('input[type="text"]').then(el => !el).catch(() => true);
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.clickButtonAndWaitForPageChange(checkPageChanged, 3, '点击Create account');
|
||||||
|
|
||||||
this.currentStep = 3;
|
this.currentStep = 3;
|
||||||
logger.success(this.siteName, `步骤 3 完成`);
|
logger.success(this.siteName, `步骤 3 完成`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user