Skip to content

Commit

Permalink
fix: 增加等待时间
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Apr 3, 2024
1 parent c523bb5 commit e439eee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require("dotenv").config();
console.error(`Error: ${error.message}`);
});
//登录操作
await page.goto("https://linux.do", { timeout: 60000 });
await page.goto("https://linux.do", { timeout: 0 });
// 使用XPath查询找到包含"登录"或"login"文本的按钮
await page.evaluate(() => {
const loginButton = Array.from(document.querySelectorAll("button")).find(
Expand All @@ -40,7 +40,7 @@ require("dotenv").config();
});

// 等待用户名输入框加载
await page.waitForSelector("#login-account-name", { timeout: 60000 });
await page.waitForSelector("#login-account-name", { timeout: 0 });
// 模拟人类在找到输入框后的短暂停顿
await delayClick(500); // 延迟500毫秒
// 清空输入框并输入用户名
Expand All @@ -50,7 +50,7 @@ require("dotenv").config();
}); // 输入时在每个按键之间添加额外的延迟

// 等待密码输入框加载
await page.waitForSelector("#login-account-password", { timeout: 60000 });
await page.waitForSelector("#login-account-password", { timeout: 0 });
// 模拟人类在输入用户名后的短暂停顿
await delayClick(500);
// 清空输入框并输入密码
Expand Down

0 comments on commit e439eee

Please sign in to comment.