stepwright
Version:
A powerful web scraping library built with Playwright
73 lines • 2.44 kB
TypeScript
import { Page, Locator } from 'playwright';
import { SelectorType } from './types';
/**
* Replace index placeholders in a string.
*
* @param {string} text - The text to replace placeholders in.
* @param {number} i - The index to replace placeholders with.
*
* @since v1.0.0
* @author Muhammad Umer Farooq <umer@lablnet.com>
*
* @returns {string} - The text with placeholders replaced.
* @since v1.0.0
* @company Framework Island
*/
export declare function replaceIndexPlaceholders(text: string | undefined, i: number, char?: string): string | undefined;
/**
* Replace data placeholders like {{key}} with values from collector.
*
* @param {string} text - The text to replace placeholders in.
* @param {object} collector - The collector object.
*
* @since v1.0.0
* @author Muhammad Umer Farooq <umer@lablnet.com>
*
* @returns {string} - The text with placeholders replaced.
* @since v1.0.0
* @company Framework Island
*/
export declare function replaceDataPlaceholders(text: string | undefined, collector: Record<string, any>): string | undefined;
/**
* Get the locator for the given selector.
*
* @param {object} page - The page object.
* @param {string} type - The type of selector.
* @param {string} selector - The selector.
*
* @since v1.0.0
* @author Muhammad Umer Farooq <umer@lablnet.com>
*
* @returns {object} - The locator.
* @since v1.0.0
* @company Framework Island
*/
export declare function locatorFor(page: Page, type: SelectorType | undefined, selector: string): Locator;
/**
* Clone a step and apply index placeholders recursively.
*
* @param {object} step - The step object.
* @param {number} idx - The index to replace placeholders with.
*
* @since v1.0.0
* @author Muhammad Umer Farooq <umer@lablnet.com>
*
* @returns {object} - The cloned step.
* @since v1.0.0
* @company Framework Island
*/
export declare function cloneStepWithIndex(step: import('./types').BaseStep, idx: number, char?: string): import('./types').BaseStep;
/**
* Flatten nested foreach results into an array.
*
* @param {object} item - Dictionary that may contain nested item_* keys.
*
* @since v1.0.0
* @author Muhammad Umer Farooq <umer@lablnet.com>
*
* @returns {any} - Either a flattened array of items or the original item.
* @since v1.0.0
* @company Framework Island
*/
export declare function flattenNestedForeachResults(item: Record<string, any>): any;
//# sourceMappingURL=utils.d.ts.map