playwright-pom-materials
Version:
Playwright POM materials
22 lines (21 loc) • 893 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.debugSelector = exports.getFrame = void 0;
const type_guards_1 = require("./type_guards");
// See https://github.com/microsoft/playwright/blob/v1.14.1/src/client/locator.ts
const getFrame = (x) => {
return (0, type_guards_1.isFrame)(x) ? x : (0, type_guards_1.isPage)(x) ? x.mainFrame() : x.page().mainFrame();
};
exports.getFrame = getFrame;
/**
* デバッグ用の関数です。ログに出力する以外の目的で使用しないでください。
* Locatorのもとになったセレクターを返します。
*
* @param locator 対象の Locator
* @returns Locatorのもとになったセレクター
*/
const debugSelector = (locator) => {
const o = locator; // eslint-disable-line @typescript-eslint/no-explicit-any
return o._selector;
};
exports.debugSelector = debugSelector;