export declare type Predicate> = (pageObject: TPageObject, index: number, pageObjects: TPageObject[]) => Promise; export interface Page { findElements(selector: string, parent?: TElement): Promise; } export interface PageObjectConstructor> { new (page: Page): TPageObject; } /** * ### Import * * **ES2015 modules** * * ```js * import {PageObject} from '@pageobject/core'; * ``` * * **CommonJS** * * ```js * const {PageObject} = require('@pageobject/core'); * ``` */ export declare abstract class PageObject { /** * The [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) describing this page object. */ readonly abstract selector: string; private readonly _page; private _element?; private _parent?; private _selectionCriterion?; constructor(page: Page); /** * You can use this method to build a tree of page objects. * Each page object in the tree should be assignable to a unique DOM element. * * @returns A new page object as a descendant of this page object. */ select>(Descendant: PageObjectConstructor): TPageObject; /** * If the position of this page object in a tree of page objects is not * sufficient to assign it a unique DOM element, you can use this method to * define a further selection criterion. * * @returns A copy of this page object with an additional selection criterion. * * @throws An error if this page object already has a selection criterion. */ where(selectionCriterion: Predicate): this; /** * @returns A promise that will be resolved with the number of DOM elements * currently assigned to this page object. */ getSize(): Promise; /** * @returns A promise that will be resolved with the representative of the * unique DOM element assigned to this page object or a promise that will be * rejected if there is no unique DOM element assignable to this page object. */ protected getElement(): Promise; private _findElements(); }