flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
68 lines (67 loc) • 3.54 kB
TypeScript
/// <reference types="node" />
import { PuppeteerElement } from "./puppeteer-element";
import { iValue } from "../interfaces/ivalue";
import { ElementHandle } from "puppeteer-core";
import { ValuePromise } from "../value-promise";
import { iBounds } from "../interfaces/ibounds";
import { KeyValue } from "../interfaces/generic-types";
import { ScreenshotOpts } from "../interfaces/screenshot";
import { iAssertionContext } from "../interfaces/iassertioncontext";
export declare class BrowserElement extends PuppeteerElement implements iValue {
protected _input: ElementHandle;
get $(): ElementHandle;
static create(input: ElementHandle, context: iAssertionContext, name: string, path?: string): Promise<BrowserElement>;
protected constructor(input: ElementHandle, context: iAssertionContext, name: string, path?: string);
find(selector: string): ValuePromise;
findAll(selector: string): Promise<BrowserElement[]>;
getAncestors(selector: string): Promise<iValue[]>;
getAncestorOrSelf(selector: string): ValuePromise;
getFirstChild(selector?: string): ValuePromise;
getLastChild(selector?: string): ValuePromise;
getFirstSibling(selector?: string): ValuePromise;
getLastSibling(selector?: string): ValuePromise;
getChildOrSelf(selector?: string): ValuePromise;
getDescendantOrSelf(selector?: string): ValuePromise;
getDescendants(selector?: string): Promise<iValue[]>;
getAncestor(selector?: string): ValuePromise;
getChildren(selector?: string): Promise<iValue[]>;
getParent(): ValuePromise;
getSiblings(selector?: string): Promise<iValue[]>;
getPreviousSibling(selector?: string): ValuePromise;
getPreviousSiblings(selector?: string): Promise<iValue[]>;
getNextSibling(selector?: string): ValuePromise;
getNextSiblings(selector?: string): Promise<iValue[]>;
getBounds(boxType?: string): Promise<iBounds | null>;
focus(): ValuePromise;
blur(): ValuePromise;
hover(): ValuePromise;
tap(): ValuePromise;
press(key: string, opts?: any): ValuePromise;
type(textToType: string, opts?: any): ValuePromise;
clear(): ValuePromise;
fillForm(attributeName: string, formData: KeyValue): ValuePromise;
fillForm(formData: KeyValue): ValuePromise;
submit(): ValuePromise;
click(): ValuePromise;
screenshot(): Promise<Buffer>;
screenshot(localFilePath: string): Promise<Buffer>;
screenshot(localFilePath: string, opts: ScreenshotOpts): Promise<Buffer>;
screenshot(opts: ScreenshotOpts): Promise<Buffer>;
selectOption(valuesToSelect: string | string[]): ValuePromise;
pressEnter(): ValuePromise;
scrollTo(): ValuePromise;
isHidden(): Promise<boolean>;
isVisible(): Promise<boolean>;
protected _getInnerText(): Promise<string>;
protected _getInnerHtml(): Promise<string>;
protected _getOuterHtml(): Promise<string>;
protected _getValue(): Promise<unknown>;
protected _getText(): Promise<string>;
protected _getClassName(): Promise<string>;
protected _getTagName(): Promise<string>;
protected _getAttribute(key: string): Promise<string | null>;
protected _isPasswordField(): Promise<boolean>;
protected _elementHandlesToFirstValue(elements: ElementHandle[], name: string, path: string): ValuePromise;
protected _elementHandlesToValueArray(elements: ElementHandle<Element>[], name: string, path: string): Promise<iValue<any>[]>;
protected _xQuery(prefix: string, selector?: string, suffix?: string): Promise<ElementHandle<Element>[]>;
}