Skip to content

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 50+ tests passed.

fix(dotnet): build against Microsoft.Playwright 1.64.1

CloakHQ06fbc5642a37
diff --git a/dotnet/src/CloakBrowser/CloakBrowser.csproj b/dotnet/src/CloakBrowser/CloakBrowser.csproj
index 2c9201e..c91e1fd 100644
--- a/dotnet/src/CloakBrowser/CloakBrowser.csproj
+++ b/dotnet/src/CloakBrowser/CloakBrowser.csproj
@@ -28,7 +28,7 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.Playwright" Version="1.49.0" />
+ <PackageReference Include="Microsoft.Playwright" Version="1.64.1" />
<PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
<!-- Ed25519 signature verification for downloaded binaries (.NET 8 has no
built-in Ed25519). Mirrors Python's `cryptography` / JS's node:crypto. -->
diff --git a/dotnet/src/CloakBrowser/Wrappers/HumanizedFrame.cs b/dotnet/src/CloakBrowser/Wrappers/HumanizedFrame.cs
index 3740e57..05458d4 100644
--- a/dotnet/src/CloakBrowser/Wrappers/HumanizedFrame.cs
+++ b/dotnet/src/CloakBrowser/Wrappers/HumanizedFrame.cs
@@ -112,7 +112,7 @@ public sealed partial class HumanizedFrame : IFrame
// Locator-returning members - re-wrap.
// -----------------------------------------------------------------------
- public IFrameLocator FrameLocator(string selector) => Humanize.WrapFrameLocator(_inner.FrameLocator(selector), _cursor, _cfg);
+ public IFrameLocator FrameLocator(string? selector = null) => Humanize.WrapFrameLocator(_inner.FrameLocator(selector), _cursor, _cfg);
public ILocator Locator(string selector, FrameLocatorOptions? options = null) => Wrap(_inner.Locator(selector, options));
public ILocator GetByAltText(string text, FrameGetByAltTextOptions? options = null) => Wrap(_inner.GetByAltText(text, options));
public ILocator GetByAltText(Regex text, FrameGetByAltTextOptions? options = null) => Wrap(_inner.GetByAltText(text, options));
diff --git a/dotnet/src/CloakBrowser/Wrappers/HumanizedPage.cs b/dotnet/src/CloakBrowser/Wrappers/HumanizedPage.cs
index 86256ef..88fb238 100644
--- a/dotnet/src/CloakBrowser/Wrappers/HumanizedPage.cs
+++ b/dotnet/src/CloakBrowser/Wrappers/HumanizedPage.cs
@@ -216,7 +216,7 @@ public sealed partial class HumanizedPage : IPage
// Locator options can change which element Playwright resolves. Preserve raw
// selector metadata only when it completely describes the locator semantics.
- public IFrameLocator FrameLocator(string selector) => Humanize.WrapFrameLocator(_inner.FrameLocator(selector), _cursor, _cfg);
+ public IFrameLocator FrameLocator(string? selector = null) => Humanize.WrapFrameLocator(_inner.FrameLocator(selector), _cursor, _cfg);
public ILocator Locator(string selector, PageLocatorOptions? options = null) =>
Wrap(_inner.Locator(selector, options), options == null ? selector : null);
public ILocator GetByAltText(string text, PageGetByAltTextOptions? options = null) => Wrap(_inner.GetByAltText(text, options));
diff --git a/dotnet/tests/CloakBrowser.Tests/IsolatedCacheDir.cs b/dotnet/tests/CloakBrowser.Tests/IsolatedCacheDir.cs
new file mode 100644
index 0000000..a25607f
--- /dev/null
+++ b/dotnet/tests/CloakBrowser.Tests/IsolatedCacheDir.cs
@@ -0,0 +1,28 @@
+using System.Runtime.CompilerServices;
+
+namespace CloakBrowser.Tests;
+
+/// <summary>
+/// Keeps the suite away from the developer's real <c>~/.cloakbrowser</c> (port of the Python
+/// <c>isolated_cache_dir</c> fixture in <c>tests/conftest.py</c>).
+///
+/// A <c>license.key</c> or a cached Pro build in the real cache dir resolves the machine as Pro,
+/// which flips version-gated defaults such as the headless no-viewport gate, so tests would assert
+/// against whatever the developer happens to have installed. Tests that set their own
+/// <c>CLOAKBROWSER_CACHE_DIR</c> still win, since they save and restore around this value.
+///
+/// Real-browser runs (<c>CLOAKBROWSER_BINARY_PATH</c> set, see <see cref="BrowserFactAttribute"/>)
+/// opt out and run like a user machine with the developer's key, as the Python fixture does.
+/// </summary>
+internal static class IsolatedCacheDir
+{
+ [ModuleInitializer]
+ internal static void Init()
+ {
+ if (BrowserFactAttribute.Available) return;
+ if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CLOAKBROWSER_CACHE_DIR"))) return;
+ var dir = Path.Combine(Path.GetTempPath(), "cloakbrowser-test-cache-" + Guid.NewGuid().ToString("N"));
+ Directory.CreateDirectory(dir);
+ Environment.SetEnvironmentVariable("CLOAKBROWSER_CACHE_DIR", dir);
+ }
+}