@orkestrel/browser 0.0.16 → 0.0.18
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/src/core/index.cjs +11 -11
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1 -1
- package/dist/src/core/index.d.ts +1 -1
- package/dist/src/core/index.js +12 -12
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.js.map +1 -1
- package/package.json +14 -14
package/dist/src/core/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ var BROWSER_MOUSE_BUTTON_MASKS = Object.freeze({
|
|
|
172
172
|
*/
|
|
173
173
|
var BROWSER_HAR_CREATOR = Object.freeze({
|
|
174
174
|
name: "@orkestrel/browser",
|
|
175
|
-
version: "0.0.
|
|
175
|
+
version: "0.0.18"
|
|
176
176
|
});
|
|
177
177
|
/** Names the attribute that tags temporary screenshot styles and masks. */
|
|
178
178
|
var BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
@@ -595,8 +595,8 @@ function parseBrowserWebSocketFrame(value) {
|
|
|
595
595
|
*/
|
|
596
596
|
function parseBrowserBindingCall(value) {
|
|
597
597
|
if (!(0, _orkestrel_contract.isRecord)(value) || !(0, _orkestrel_contract.isString)(value["name"]) || !(0, _orkestrel_contract.isString)(value["payload"]) || !(0, _orkestrel_contract.isInteger)(value["executionContextId"])) return;
|
|
598
|
-
const payload = (0, _orkestrel_contract.
|
|
599
|
-
if (
|
|
598
|
+
const payload = (0, _orkestrel_contract.parseJSONAs)(value["payload"], _orkestrel_contract.isRecord);
|
|
599
|
+
if (payload === void 0 || !(0, _orkestrel_contract.isString)(payload["id"]) || !(0, _orkestrel_contract.isString)(payload["name"]) || !(0, _orkestrel_contract.isArray)(payload["args"]) || payload["name"] !== value["name"]) return;
|
|
600
600
|
return {
|
|
601
601
|
id: payload["id"],
|
|
602
602
|
name: payload["name"],
|
|
@@ -722,8 +722,8 @@ function parseBrowserDownloadProgress(value) {
|
|
|
722
722
|
*/
|
|
723
723
|
function parseCodegenActionPayload(payload) {
|
|
724
724
|
if (!(0, _orkestrel_contract.isString)(payload)) return void 0;
|
|
725
|
-
const parsed = (0, _orkestrel_contract.
|
|
726
|
-
if (
|
|
725
|
+
const parsed = (0, _orkestrel_contract.parseJSONAs)(payload, _orkestrel_contract.isRecord);
|
|
726
|
+
if (parsed === void 0) return void 0;
|
|
727
727
|
const action = (0, _orkestrel_contract.parseEnum)(parsed["action"], [
|
|
728
728
|
"click",
|
|
729
729
|
"fill",
|
|
@@ -777,8 +777,7 @@ function parseCodegenNavigateAction(params) {
|
|
|
777
777
|
* @returns The number array, or undefined
|
|
778
778
|
*/
|
|
779
779
|
function parseNumberArray(value) {
|
|
780
|
-
|
|
781
|
-
return value;
|
|
780
|
+
return (0, _orkestrel_contract.parseArray)(value, _orkestrel_contract.isFiniteNumber);
|
|
782
781
|
}
|
|
783
782
|
/**
|
|
784
783
|
* Coerces one CDP snapshot string-table index to its string, or `undefined`
|
|
@@ -2052,8 +2051,8 @@ function readBrowserAttributes(value, strings) {
|
|
|
2052
2051
|
function readBrowserSnapshot(value, styles = [], limit = BROWSER_SNAPSHOT_NODE_LIMIT) {
|
|
2053
2052
|
if (!(0, _orkestrel_contract.isInteger)(limit) || limit < 0) throw new BrowserError("Browser snapshot limit must be a non-negative integer", void 0, { limit });
|
|
2054
2053
|
if (!(0, _orkestrel_contract.isRecord)(value) || !(0, _orkestrel_contract.isArray)(value["strings"]) || !(0, _orkestrel_contract.isArray)(value["documents"])) throw new BrowserError("Malformed DOMSnapshot.captureSnapshot result");
|
|
2055
|
-
|
|
2056
|
-
|
|
2054
|
+
const strings = (0, _orkestrel_contract.parseArray)(value["strings"], _orkestrel_contract.isString);
|
|
2055
|
+
if (strings === void 0) throw new BrowserError("Malformed DOMSnapshot string table");
|
|
2057
2056
|
let count = 0;
|
|
2058
2057
|
for (const document of value["documents"]) {
|
|
2059
2058
|
if (!(0, _orkestrel_contract.isRecord)(document) || !(0, _orkestrel_contract.isRecord)(document["nodes"])) continue;
|
|
@@ -4736,8 +4735,9 @@ var BrowserLocator = class BrowserLocator {
|
|
|
4736
4735
|
}
|
|
4737
4736
|
async texts() {
|
|
4738
4737
|
const value = await this.#frame.evaluate(`(${compileLocatorListExpression(this.#query)}).map((element) => element.innerText)`);
|
|
4739
|
-
|
|
4740
|
-
|
|
4738
|
+
const texts = (0, _orkestrel_contract.parseArray)(value, _orkestrel_contract.isString);
|
|
4739
|
+
if (texts === void 0) throw new BrowserError("Browser locator text list is malformed");
|
|
4740
|
+
return texts;
|
|
4741
4741
|
}
|
|
4742
4742
|
async html() {
|
|
4743
4743
|
return await this.#string("outerHTML", "Browser locator HTML");
|