This commit is contained in:
dengqichen 2025-11-17 00:46:25 +08:00
parent aa619cd3b4
commit c9e24bbb85

View File

@ -640,10 +640,28 @@ class WindsurfRegister {
if (selectButton) { if (selectButton) {
logger.info(this.siteName, ' → 点击"Select plan"按钮...'); logger.info(this.siteName, ' → 点击"Select plan"按钮...');
await selectButton.click();
// 等待页面跳转或加载 // 点击后会跳转到 Stripe checkout 页面,需要等待导航完成
await this.human.randomDelay(3000, 5000); logger.info(this.siteName, ' → 等待跳转到支付页面...');
await Promise.all([
this.page.waitForNavigation({
waitUntil: 'networkidle2',
timeout: 30000
}).catch(e => {
logger.warn(this.siteName, ` → 导航等待异常: ${e.message}`);
}),
selectButton.click()
]);
// 额外等待页面稳定
await this.human.randomDelay(2000, 3000);
const currentUrl = this.page.url();
logger.info(this.siteName, ` → 当前URL: ${currentUrl}`);
if (currentUrl.includes('checkout.stripe.com')) {
logger.success(this.siteName, ' → ✓ 已跳转到 Stripe 支付页面');
}
this.currentStep = 5; this.currentStep = 5;
logger.success(this.siteName, `步骤 5 完成`); logger.success(this.siteName, `步骤 5 完成`);
@ -722,27 +740,27 @@ class WindsurfRegister {
await this.page.waitForSelector('#cardNumber', { visible: true, timeout: 10000 }); await this.page.waitForSelector('#cardNumber', { visible: true, timeout: 10000 });
await this.page.click('#cardNumber'); await this.page.click('#cardNumber');
await this.human.randomDelay(500, 1000); await this.human.randomDelay(500, 1000);
await this.page.type('#cardNumber', card.number, { delay: 100 }); await this.page.type('#cardNumber', card.number, { delay: 250 });
// 4. 填写有效期(月份/年份) // 4. 填写有效期(月份/年份)
logger.info(this.siteName, ' → 填写有效期...'); logger.info(this.siteName, ' → 填写有效期...');
await this.page.click('#cardExpiry'); await this.page.click('#cardExpiry');
await this.human.randomDelay(300, 500); await this.human.randomDelay(300, 500);
const expiry = `${card.month}${card.year}`; // 格式: MMYY const expiry = `${card.month}${card.year}`; // 格式: MMYY
await this.page.type('#cardExpiry', expiry, { delay: 100 }); await this.page.type('#cardExpiry', expiry, { delay: 250 });
// 5. 填写CVC // 5. 填写CVC
logger.info(this.siteName, ' → 填写CVC...'); logger.info(this.siteName, ' → 填写CVC...');
await this.page.click('#cardCvc'); await this.page.click('#cardCvc');
await this.human.randomDelay(300, 500); await this.human.randomDelay(300, 500);
await this.page.type('#cardCvc', card.cvv, { delay: 100 }); await this.page.type('#cardCvc', card.cvv, { delay: 250 });
// 6. 填写持卡人姓名 // 6. 填写持卡人姓名
logger.info(this.siteName, ' → 填写持卡人姓名...'); logger.info(this.siteName, ' → 填写持卡人姓名...');
await this.page.click('#billingName'); await this.page.click('#billingName');
await this.human.randomDelay(300, 500); await this.human.randomDelay(300, 500);
const fullName = `${this.accountData.firstName} ${this.accountData.lastName}`; const fullName = `${this.accountData.firstName} ${this.accountData.lastName}`;
await this.page.type('#billingName', fullName, { delay: 100 }); await this.page.type('#billingName', fullName, { delay: 200 });
// 7. 选择地址:中国澳门特别行政区 // 7. 选择地址:中国澳门特别行政区
logger.info(this.siteName, ' → 选择地址:中国澳门特别行政区...'); logger.info(this.siteName, ' → 选择地址:中国澳门特别行政区...');