import { ElementHandle } from 'playwright'; import { PlaywrightFluent } from '../fluent-api'; import { ClickOptions, HoverOptions, Point, SelectOptionInfo, SerializableDOMRect, VerboseOptions } from '../actions'; export declare class SelectorFluent { private chainingHistory; private pwf; private actionInfos; private getActionFrom; private executeActions; /** * Executes the search. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @returns {Promise[]>} will return an empty array if no elements are found, will return all found elements otherwise. * @memberof SelectorFluent */ getAllHandles(): Promise[]>; /** * Iterate over each found selector * The index is the 1-based index of the selector in the list of selectors * @param {(selector: SelectorFluent, index: number) => Promise} func * @returns {Promise} * @memberof SelectorFluent * @example * const rows = p.selector('[role="row"]'); * await rows.forEach(async (row) => { * const checkbox = row.find('input[type="checkbox"]'); * await p.hover(checkbox).check(checkbox); * }); */ forEach(func: (selector: SelectorFluent, index: number) => Promise): Promise; /** * Obsolete: please use the getHandle() method. * Executes the search and returns the first found element. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @returns {Promise | null>} will return null if no elements are found, will return first found element otherwise. * @memberof SelectorFluent * @obsolete */ getFirstHandleOrNull(): Promise | null>; /** * Executes the search and returns the first found element. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @returns {Promise | null>} will return null if no elements are found, will return first found element otherwise. * @memberof SelectorFluent */ getHandle(): Promise | null>; /** * Gets the number of found elements. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @returns {Promise} will return 0 if no elements are found. * @memberof SelectorFluent */ count(): Promise; /** * */ constructor(selector: string, pwf: PlaywrightFluent, stringifiedState?: string); toString(): string; private createSelectorFrom; find(selector: string): SelectorFluent; /** * Finds, from previous search, all elements whose innerText contains the specified text * * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withText(text: string): SelectorFluent; /** * Finds, from previous search, all elements whose innerText match exactly the specified text. * Use that method when you need to find elements with empty content. * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withExactText(text: string): SelectorFluent; /** * Finds, from previous search, all elements whose value contains the specified text * * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withValue(text: string): SelectorFluent; /** * Finds, from previous search, all elements whose placeholder contains the specified text * * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withPlaceholder(text: string): SelectorFluent; /** * Finds, from previous search, all elements whose aria-label matches exactly the specified text * * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withAriaLabel(text: string): SelectorFluent; /** * Finds, from previous search, all elements whose role attribute matches exactly the specified text * * @param {string} text * @returns {SelectorFluent} * @memberof SelectorFluent */ withRole(text: string): SelectorFluent; parent(): SelectorFluent; nextSibling(): SelectorFluent; previousSibling(): SelectorFluent; /** * Takes the nth element found at the previous step * * @param {number} index : 1-based index * @returns {SelectorFluent} * @memberof SelectorFluent * @example * nth(1): take the first element found at previous step. * nth(-1): take the last element found at previous step. */ nth(index: number): SelectorFluent; /** * Checks if selector exists. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the disability status is the one known when executing this method. * * @returns {Promise} * @memberof SelectorFluent */ exists(): Promise; /** * Checks if selector is not in the DOM. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the existence status is the one known when executing this method. * * @returns {Promise} * @memberof SelectorFluent */ doesNotExist(): Promise; /** * Checks if the selector is visible. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the visibilty status is the one known when executing this method. * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isVisible(options?: Partial): Promise; /** * Checks if the selector is visible in the current viewport. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the visibilty status is the one known when executing this method. * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isVisibleInViewport(options?: Partial): Promise; /** * Checks that the selector is not visible. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the visibilty status is the one known when executing this method. * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isNotVisible(options?: Partial): Promise; /** * Checks that the selector is not visible in the current viewport. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the visibilty status is the one known when executing this method. * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isNotVisibleInViewport(options?: Partial): Promise; /** * Checks if the selector is enabled. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the enability status is the one known when executing this method. * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isEnabled(options?: Partial): Promise; /** * Checks if the selector is disabled. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the disability status is the one known when executing this method. * * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isDisabled(options?: Partial): Promise; /** * Checks if the selector is read-only. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the disability status is the one known when executing this method. * * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isReadOnly(options?: Partial): Promise; /** * Checks if the selector is not read-only. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the disability status is the one known when executing this method. * * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isNotReadOnly(options?: Partial): Promise; innerText(): Promise; value(): Promise; classList(): Promise; getAttribute(attributeName: string): Promise; /** * Get the placeholder content * * @returns {(Promise)} * @memberof SelectorFluent */ placeholder(): Promise; /** * Get the client rectangle of the selector * * @returns {(Promise)} * @memberof SelectorFluent */ clientRectangle(): Promise; /** * Get the position of the center of selector's bounding box. * * @returns {(Promise)} * @memberof SelectorFluent */ position(): Promise; /** * Get the position of the left centered point of the selector's bounding box. * * @returns {(Promise)} * @memberof SelectorFluent */ leftPosition(): Promise; /** * Get the position of the right centered point of the selector's bounding box. * * @returns {(Promise)} * @memberof SelectorFluent */ rightPosition(): Promise; /** * Checks that selector has the an attribute with an expected value * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @param {string} attributeName * @param {string} expectedAttributeValue * @returns {Promise} * @memberof SelectorFluent */ hasAttributeWithValue(attributeName: string, expectedAttributeValue: string): Promise; /** * Checks that selector has the specified class * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @param {string} expectedClass * @returns {Promise} * @memberof SelectorFluent */ hasClass(expectedClass: string): Promise; /** * Checks that selector does not have the specified class * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * * @param {string} expectedClass * @returns {Promise} * @memberof SelectorFluent */ doesNotHaveClass(expectedClass: string): Promise; /** * Checks that the selector is checked. * If the selector targets multiple DOM elements, this check is done only on the first one found. * The result may differ from one execution to another * especially if targeted element is rendered lately because its data is based on some backend response. * So the checked status is the one known when executing this method. * * @param {Partial} [options=defaultVerboseOptions] * @returns {Promise} * @memberof SelectorFluent */ isChecked(options?: Partial): Promise; isUnchecked(options?: Partial): Promise; options(): Promise; allSelectedOptions(): Promise; selectedOption(): Promise; /** * hover over selector * @param {Partial} [options=defaultHoverOptions] * @returns {Promise} * @memberof SelectorFluent */ hover(options?: Partial): Promise; /** * click on selector * * @param {Partial} [options=defaultClickOptions] * @returns {Promise} * @memberof SelectorFluent */ click(options?: Partial): Promise; }