real-browser-mcp-server 1.0.7 → 1.0.8

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/lib/cjs/index.js CHANGED
@@ -75,7 +75,7 @@ function setupRealPage(browser, page, options = {}) {
75
75
  page._setupApplied = true;
76
76
 
77
77
  const headless = options.headless !== undefined ? options.headless : getDefaultHeadless();
78
- const showCursor = options.showCursor !== undefined ? options.showCursor : !headless;
78
+ const showCursor = options.showCursor !== undefined ? options.showCursor : false;
79
79
 
80
80
  // Enable ad blocker
81
81
  if (adBlockerInstance) {
@@ -335,7 +335,7 @@ async function connect({
335
335
 
336
336
  await applyUserAgentOverride(page, modifiedUa, userAgentMetadata);
337
337
 
338
- const showCursor = visualCursor !== undefined ? visualCursor : !headless;
338
+ const showCursor = visualCursor !== undefined ? visualCursor : false;
339
339
 
340
340
  setupRealPage(browser, page, { headless, showCursor });
341
341
 
package/lib/esm/index.mjs CHANGED
@@ -80,7 +80,7 @@ function setupRealPage(browser, page, options = {}) {
80
80
  page._setupApplied = true;
81
81
 
82
82
  const headless = options.headless !== undefined ? options.headless : getDefaultHeadless();
83
- const showCursor = options.showCursor !== undefined ? options.showCursor : !headless;
83
+ const showCursor = options.showCursor !== undefined ? options.showCursor : false;
84
84
 
85
85
  // Enable ad blocker
86
86
  if (adBlockerInstance) {
@@ -339,7 +339,7 @@ export async function connect({
339
339
 
340
340
  await applyUserAgentOverride(page, modifiedUa, userAgentMetadata);
341
341
 
342
- const showCursor = visualCursor !== undefined ? visualCursor : !headless;
342
+ const showCursor = visualCursor !== undefined ? visualCursor : false;
343
343
 
344
344
  setupRealPage(browser, page, { headless, showCursor });
345
345
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "real-browser-mcp-server",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "MCP Server for Real Browser - Patchright (undetected Playwright fork) with Stealth Mode, Ad Blocker, and Turnstile Auto-Solver for undetectable web automation.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.mjs",
package/src/ai/core.js CHANGED
@@ -90,9 +90,13 @@ class AICore {
90
90
  if (element) {
91
91
  if (humanLike) {
92
92
  try {
93
- const { createCursor } = require('ghost-cursor-patchright');
94
- const cursor = createCursor(page);
95
- await cursor.click(selector);
93
+ if (page.realClick) {
94
+ await page.realClick(selector);
95
+ } else {
96
+ const { createCursor } = require('ghost-cursor-patchright');
97
+ const cursor = await createCursor(page);
98
+ await cursor.click(selector);
99
+ }
96
100
  } catch {
97
101
  await element.click();
98
102
  }
@@ -2005,9 +2005,13 @@ const handlers = {
2005
2005
 
2006
2006
  // Click submit button with human-like behavior
2007
2007
  try {
2008
- const { createCursor } = require('ghost-cursor-patchright');
2009
- const cursor = createCursor(page);
2010
- await cursor.click(submitSelector);
2008
+ if (page.realClick) {
2009
+ await page.realClick(submitSelector);
2010
+ } else {
2011
+ const { createCursor } = require('ghost-cursor-patchright');
2012
+ const cursor = await createCursor(page);
2013
+ await cursor.click(submitSelector);
2014
+ }
2011
2015
  } catch (e) {
2012
2016
  await page.click(submitSelector);
2013
2017
  }
@@ -4769,13 +4773,18 @@ const handlers = {
4769
4773
  }
4770
4774
  }
4771
4775
  }, identity, String(value));
4772
- } else {
4773
4776
  // Smart Type
4774
- const { createCursor } = require('ghost-cursor-patchright');
4775
- const cursor = createCursor(page);
4776
-
4777
- // Click center of element
4778
- await cursor.click(identity);
4777
+ if (page.realClick) {
4778
+ await page.realClick(identity);
4779
+ } else {
4780
+ try {
4781
+ const { createCursor } = require('ghost-cursor-patchright');
4782
+ const cursor = await createCursor(page);
4783
+ await cursor.click(identity);
4784
+ } catch (e) {
4785
+ await page.click(identity);
4786
+ }
4787
+ }
4779
4788
 
4780
4789
  // Clear existing
4781
4790
  await page.evaluate(s => document.querySelector(s).value = '', identity);
@@ -4838,9 +4847,17 @@ const handlers = {
4838
4847
  });
4839
4848
 
4840
4849
  if (submitSelector) {
4841
- const { createCursor } = require('ghost-cursor-patchright');
4842
- const cursor = createCursor(page);
4843
- await cursor.click(submitSelector);
4850
+ if (page.realClick) {
4851
+ await page.realClick(submitSelector);
4852
+ } else {
4853
+ try {
4854
+ const { createCursor } = require('ghost-cursor-patchright');
4855
+ const cursor = await createCursor(page);
4856
+ await cursor.click(submitSelector);
4857
+ } catch (e) {
4858
+ await page.click(submitSelector);
4859
+ }
4860
+ }
4844
4861
 
4845
4862
  try {
4846
4863
  await page.waitForNavigation({ timeout: 5000, waitUntil: 'domcontentloaded' });
package/test/cjs/test.js CHANGED
@@ -4,7 +4,7 @@ const { connect } = require('../../lib/cjs/index.js');
4
4
 
5
5
  const realBrowserOption = {
6
6
  turnstile: true,
7
- headless: true,
7
+ headless: false,
8
8
  customConfig: {}
9
9
  }
10
10
 
@@ -32,7 +32,9 @@ test.after(async () => {
32
32
 
33
33
  test('DrissionPage Detector', async () => {
34
34
  await page.goto("https://web.archive.org/web/20240913054632/https://drissionpage.pages.dev/", { timeout: 60000 });
35
+ await page.waitForSelector("#detector", { timeout: 20000 });
35
36
  await page.realClick("#detector")
37
+ await page.waitForSelector("#isBot span", { timeout: 20000 });
36
38
  let result = await page.evaluate(() => { return document.querySelector('#isBot span').textContent.includes("not") ? true : false })
37
39
  assert.strictEqual(result, true, "DrissionPage Detector test failed!")
38
40
  })
package/test/esm/test.mjs CHANGED
@@ -4,7 +4,7 @@ import { connect } from '../../lib/esm/index.mjs';
4
4
 
5
5
  const realBrowserOption = {
6
6
  turnstile: true,
7
- headless: true,
7
+ headless: false,
8
8
  customConfig: {}
9
9
  }
10
10
 
@@ -32,7 +32,9 @@ test.after(async () => {
32
32
 
33
33
  test('DrissionPage Detector', async () => {
34
34
  await page.goto("https://web.archive.org/web/20240913054632/https://drissionpage.pages.dev/", { timeout: 70000 });
35
+ await page.waitForSelector("#detector", { timeout: 20000 });
35
36
  await page.realClick("#detector")
37
+ await page.waitForSelector("#isBot span", { timeout: 20000 });
36
38
  let result = await page.evaluate(() => { return document.querySelector('#isBot span').textContent.includes("not") ? true : false })
37
39
  assert.strictEqual(result, true, "DrissionPage Detector test failed!")
38
40
  })