browserclaw 0.4.1 → 0.4.3

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/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  <p align="center">
4
4
  <a href="https://www.npmjs.com/package/browserclaw"><img src="https://img.shields.io/npm/v/browserclaw.svg" alt="npm version" /></a>
5
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
5
6
  <a href="https://www.npmjs.com/package/browserclaw"><img src="https://img.shields.io/npm/dw/browserclaw" alt="npm downloads" /></a>
6
7
  <a href="https://github.com/idan-rubin/browserclaw/stargazers"><img src="https://img.shields.io/github/stars/idan-rubin/browserclaw" alt="GitHub stars" /></a>
7
- <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
8
8
  </p>
9
9
 
10
10
  Extracted and refined from [OpenClaw](https://github.com/openclaw/openclaw)'s browser automation module. A standalone, typed library for AI-friendly browser control with **snapshot + ref targeting** — no CSS selectors, no XPath, no vision, just numbered refs that map to interactive elements.
package/dist/index.cjs CHANGED
@@ -849,7 +849,7 @@ async function findPageByTargetId(browser, targetId, cdpUrl) {
849
849
  }
850
850
  if (cdpUrl) {
851
851
  try {
852
- const listUrl = `${cdpUrl.replace(/\/+$/, "").replace(/^ws:/, "http:").replace(/\/cdp$/, "")}/json/list`;
852
+ const listUrl = `${normalizeCdpHttpBaseForJsonEndpoints(cdpUrl)}/json/list`;
853
853
  const headers = {};
854
854
  if (cached?.authToken) headers["Authorization"] = `Bearer ${cached.authToken}`;
855
855
  const response = await fetch(listUrl, { headers });
@@ -1827,7 +1827,7 @@ async function createPageViaPlaywright(opts) {
1827
1827
  ensurePageState(page);
1828
1828
  if (targetUrl !== "about:blank") {
1829
1829
  const navigationPolicy = withBrowserNavigationPolicy(policy);
1830
- const response = await page.goto(targetUrl, { timeout: normalizeTimeoutMs(void 0, 2e4) });
1830
+ const response = await page.goto(targetUrl, { timeout: normalizeTimeoutMs(void 0, 2e4) }).catch(() => null);
1831
1831
  await assertBrowserNavigationRedirectChainAllowed({ request: response?.request(), ...navigationPolicy });
1832
1832
  await assertBrowserNavigationResultAllowed({ url: page.url(), ssrfPolicy: policy });
1833
1833
  }