@cli4ai/chrome 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli4ai.json +1 -1
- package/package.json +1 -1
- package/run.ts +16 -0
package/cli4ai.json
CHANGED
package/package.json
CHANGED
package/run.ts
CHANGED
|
@@ -49,10 +49,26 @@ async function launchBrowser(headless: boolean): Promise<Browser> {
|
|
|
49
49
|
'--no-first-run',
|
|
50
50
|
'--no-default-browser-check',
|
|
51
51
|
'--disable-infobars',
|
|
52
|
+
'--disable-blink-features=AutomationControlled',
|
|
53
|
+
'--disable-features=IsolateOrigins,site-per-process',
|
|
52
54
|
],
|
|
53
55
|
defaultViewport: null, // Use full window size
|
|
56
|
+
ignoreDefaultArgs: ['--enable-automation'],
|
|
54
57
|
});
|
|
55
58
|
|
|
59
|
+
// Remove automation detection signals
|
|
60
|
+
const userAgent = process.platform === 'win32'
|
|
61
|
+
? 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'
|
|
62
|
+
: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36';
|
|
63
|
+
|
|
64
|
+
const pages = await browser.pages();
|
|
65
|
+
for (const page of pages) {
|
|
66
|
+
await page.setUserAgent(userAgent);
|
|
67
|
+
await page.evaluateOnNewDocument(() => {
|
|
68
|
+
Object.defineProperty(navigator, 'webdriver', { get: () => undefined });
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
// Save connection info
|
|
57
73
|
const wsEndpoint = browser.wsEndpoint();
|
|
58
74
|
writeFileSync(WS_FILE, wsEndpoint);
|