@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.
Files changed (3) hide show
  1. package/cli4ai.json +1 -1
  2. package/package.json +1 -1
  3. package/run.ts +16 -0
package/cli4ai.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Chrome browser automation with managed browser instance",
5
5
  "author": "cliforai",
6
6
  "license": "BUSL-1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cli4ai/chrome",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Chrome browser automation with managed browser instance",
5
5
  "author": "cliforai",
6
6
  "license": "BUSL-1.1",
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);