docs: align yunpan1 captcha code with tested flow

- 填值 + dispatchEvent (input/change)
- 遍历 button 找"提交"
- 弹窗不消失时导航到板块页面

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 22:00:36 +08:00
parent af5059c585
commit 3d37edfebf
+21 -5
View File
@@ -7,12 +7,28 @@
网站有时弹窗要求输入验证码。检测到输入框时填入: 网站有时弹窗要求输入验证码。检测到输入框时填入:
```javascript ```javascript
const captchaInput = page.locator('input[placeholder*="验证码"]'); // 第一步:填入验证码
if (await captchaInput.isVisible()) { await page.evaluate(() => {
await captchaInput.fill('392718'); const input = document.querySelector('input[placeholder*="验证码"]');
await page.locator('button:has-text("提交")').click(); if (input) {
await page.waitForTimeout(2000); input.value = '392718';
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new Event('change', { bubbles: true }));
} }
});
// 第二步:点击提交按钮
await page.evaluate(() => {
let target = null;
document.querySelectorAll('button').forEach(b => {
if (b.textContent.includes('提交')) target = b;
});
if (target) target.click();
});
// 第三步:弹窗可能不自动消失,导航到板块页面即可
await page.goto('https://yunpan1.cc/forum.php?mod=forumdisplay&fid=3');
await page.waitForTimeout(2000);
``` ```
## 前置检查 ## 前置检查