Skip to content

Commit

Permalink
Merge pull request #94 from zmzimpl/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
zmzimpl authored Feb 27, 2025
2 parents e8f42eb + 0c7c3a1 commit 16eafe7
Show file tree
Hide file tree
Showing 10 changed files with 679 additions and 13 deletions.
1 change: 1 addition & 0 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable */
// @ts-nocheck
import {batchCreateWindows, getAllWindows} from './demo/window.js';
import {openProfile} from './demo/profiles.js';

Expand Down
1 change: 0 additions & 1 deletion examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions examples/puppeteer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// 不检查 eslint
/* eslint-disable */
// @ts-nocheck

import puppeteer from 'puppeteer';

export async function createBrowser() {
import {openProfile} from './demo/profiles.js';
export async function createBrowser(wsEndpoint) {
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/05efd11e-4025-4eb3-ab97-9e335efa354a',
browserWSEndpoint: wsEndpoint,
defaultViewport: null,
});
return browser;
Expand All @@ -18,10 +18,18 @@ async function randomWait(min, max) {
}

// 主要的自动化脚本函数
export async function autoScript(browser) {}
export async function autoScript(browser) {
try {

} catch (error) {
console.error('自动化脚本执行出错:', error);
}
}

(async () => {
const browser = await createBrowser();
const openResult = await openProfile(77);
console.log(openResult);
const browser = await createBrowser(openResult.browser.webSocketDebuggerUrl);
await autoScript(browser);
// await browser.close(); // Only if you want to close the external Chrome instance.
})();
Loading

0 comments on commit 16eafe7

Please sign in to comment.