browserclaw 0.10.2 → 0.10.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/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3085,6 +3085,17 @@ function requiresInspectableBrowserNavigationRedirects(ssrfPolicy) {
|
|
|
3085
3085
|
var MAX_CLICK_DELAY_MS = 5e3;
|
|
3086
3086
|
var DEFAULT_SCROLL_TIMEOUT_MS = 2e4;
|
|
3087
3087
|
var CHECKABLE_ROLES = /* @__PURE__ */ new Set(["menuitemcheckbox", "menuitemradio", "checkbox", "switch"]);
|
|
3088
|
+
async function setCheckedViaEvaluate(locator, checked) {
|
|
3089
|
+
await locator.evaluate((el, desired) => {
|
|
3090
|
+
const input = el;
|
|
3091
|
+
const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "checked");
|
|
3092
|
+
if (desc?.set) desc.set.call(input, desired);
|
|
3093
|
+
else input.checked = desired;
|
|
3094
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3095
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
3096
|
+
input.click();
|
|
3097
|
+
}, checked);
|
|
3098
|
+
}
|
|
3088
3099
|
function resolveLocator(page, resolved) {
|
|
3089
3100
|
if (resolved.ref !== void 0 && resolved.ref !== "") return refLocator(page, resolved.ref);
|
|
3090
3101
|
const sel = resolved.selector ?? "";
|
|
@@ -3259,8 +3270,12 @@ async function fillFormViaPlaywright(opts) {
|
|
|
3259
3270
|
const checked = rawValue === true || rawValue === 1 || rawValue === "1" || rawValue === "true";
|
|
3260
3271
|
try {
|
|
3261
3272
|
await locator.setChecked(checked, { timeout, force: true });
|
|
3262
|
-
} catch
|
|
3263
|
-
|
|
3273
|
+
} catch {
|
|
3274
|
+
try {
|
|
3275
|
+
await setCheckedViaEvaluate(locator, checked);
|
|
3276
|
+
} catch (err) {
|
|
3277
|
+
throw toAIFriendlyError(err, ref);
|
|
3278
|
+
}
|
|
3264
3279
|
}
|
|
3265
3280
|
continue;
|
|
3266
3281
|
}
|