@orkestrel/browser 0.0.16 → 0.0.17
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/package.json +10 -10
|
@@ -53,7 +53,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
55
55
|
name: "@orkestrel/browser";
|
|
56
|
-
version: "0.0.
|
|
56
|
+
version: "0.0.17";
|
|
57
57
|
}>;
|
|
58
58
|
|
|
59
59
|
/** Maps a canonical modifier name to its CDP Input modifier bit value. */
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
55
55
|
name: "@orkestrel/browser";
|
|
56
|
-
version: "0.0.
|
|
56
|
+
version: "0.0.17";
|
|
57
57
|
}>;
|
|
58
58
|
|
|
59
59
|
/** Maps a canonical modifier name to its CDP Input modifier bit value. */
|
package/dist/src/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attempt, instanceOf, isArray, isBoolean, isFiniteNumber, isFunction, isInstance, isInteger, isRecord, isString, parseArray, parseEnum, parseJSON } from "@orkestrel/contract";
|
|
1
|
+
import { attempt, instanceOf, isArray, isBoolean, isFiniteNumber, isFunction, isInstance, isInteger, isRecord, isString, parseArray, parseEnum, parseJSON, parseJSONAs } from "@orkestrel/contract";
|
|
2
2
|
import { Emitter } from "@orkestrel/emitter";
|
|
3
3
|
import { createHTML, renderText } from "@orkestrel/html";
|
|
4
4
|
//#region src/core/constants.ts
|
|
@@ -171,7 +171,7 @@ var BROWSER_MOUSE_BUTTON_MASKS = Object.freeze({
|
|
|
171
171
|
*/
|
|
172
172
|
var BROWSER_HAR_CREATOR = Object.freeze({
|
|
173
173
|
name: "@orkestrel/browser",
|
|
174
|
-
version: "0.0.
|
|
174
|
+
version: "0.0.17"
|
|
175
175
|
});
|
|
176
176
|
/** Names the attribute that tags temporary screenshot styles and masks. */
|
|
177
177
|
var BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
@@ -594,8 +594,8 @@ function parseBrowserWebSocketFrame(value) {
|
|
|
594
594
|
*/
|
|
595
595
|
function parseBrowserBindingCall(value) {
|
|
596
596
|
if (!isRecord(value) || !isString(value["name"]) || !isString(value["payload"]) || !isInteger(value["executionContextId"])) return;
|
|
597
|
-
const payload =
|
|
598
|
-
if (
|
|
597
|
+
const payload = parseJSONAs(value["payload"], isRecord);
|
|
598
|
+
if (payload === void 0 || !isString(payload["id"]) || !isString(payload["name"]) || !isArray(payload["args"]) || payload["name"] !== value["name"]) return;
|
|
599
599
|
return {
|
|
600
600
|
id: payload["id"],
|
|
601
601
|
name: payload["name"],
|
|
@@ -721,8 +721,8 @@ function parseBrowserDownloadProgress(value) {
|
|
|
721
721
|
*/
|
|
722
722
|
function parseCodegenActionPayload(payload) {
|
|
723
723
|
if (!isString(payload)) return void 0;
|
|
724
|
-
const parsed =
|
|
725
|
-
if (
|
|
724
|
+
const parsed = parseJSONAs(payload, isRecord);
|
|
725
|
+
if (parsed === void 0) return void 0;
|
|
726
726
|
const action = parseEnum(parsed["action"], [
|
|
727
727
|
"click",
|
|
728
728
|
"fill",
|
|
@@ -776,8 +776,7 @@ function parseCodegenNavigateAction(params) {
|
|
|
776
776
|
* @returns The number array, or undefined
|
|
777
777
|
*/
|
|
778
778
|
function parseNumberArray(value) {
|
|
779
|
-
|
|
780
|
-
return value;
|
|
779
|
+
return parseArray(value, isFiniteNumber);
|
|
781
780
|
}
|
|
782
781
|
/**
|
|
783
782
|
* Coerces one CDP snapshot string-table index to its string, or `undefined`
|
|
@@ -2051,8 +2050,8 @@ function readBrowserAttributes(value, strings) {
|
|
|
2051
2050
|
function readBrowserSnapshot(value, styles = [], limit = BROWSER_SNAPSHOT_NODE_LIMIT) {
|
|
2052
2051
|
if (!isInteger(limit) || limit < 0) throw new BrowserError("Browser snapshot limit must be a non-negative integer", void 0, { limit });
|
|
2053
2052
|
if (!isRecord(value) || !isArray(value["strings"]) || !isArray(value["documents"])) throw new BrowserError("Malformed DOMSnapshot.captureSnapshot result");
|
|
2054
|
-
|
|
2055
|
-
|
|
2053
|
+
const strings = parseArray(value["strings"], isString);
|
|
2054
|
+
if (strings === void 0) throw new BrowserError("Malformed DOMSnapshot string table");
|
|
2056
2055
|
let count = 0;
|
|
2057
2056
|
for (const document of value["documents"]) {
|
|
2058
2057
|
if (!isRecord(document) || !isRecord(document["nodes"])) continue;
|
|
@@ -4735,8 +4734,9 @@ var BrowserLocator = class BrowserLocator {
|
|
|
4735
4734
|
}
|
|
4736
4735
|
async texts() {
|
|
4737
4736
|
const value = await this.#frame.evaluate(`(${compileLocatorListExpression(this.#query)}).map((element) => element.innerText)`);
|
|
4738
|
-
|
|
4739
|
-
|
|
4737
|
+
const texts = parseArray(value, isString);
|
|
4738
|
+
if (texts === void 0) throw new BrowserError("Browser locator text list is malformed");
|
|
4739
|
+
return texts;
|
|
4740
4740
|
}
|
|
4741
4741
|
async html() {
|
|
4742
4742
|
return await this.#string("outerHTML", "Browser locator HTML");
|