flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
43 lines (42 loc) • 2.32 kB
TypeScript
/// <reference types="cheerio" />
import { DOMElement } from "./dom-element";
import { iAssertionContext } from "../interfaces/iassertioncontext";
import { ValuePromise } from "../value-promise";
import { FindAllOptions, FindOptions } from "../interfaces/find-options";
import { KeyValue } from "../interfaces/generic-types";
import { iValue } from "../interfaces/ivalue";
export declare class HTMLElement<T = any> extends DOMElement implements iValue<T> {
protected _path: string;
get $(): T;
protected get el(): cheerio.Cheerio;
static create(input: any, context: iAssertionContext, name?: string | null, path?: string): Promise<HTMLElement<any>>;
protected constructor(input: T, context: iAssertionContext, name?: string | null, path?: string);
find(selector: string, a?: string | RegExp | FindOptions, b?: FindOptions): ValuePromise;
findAll(selector: string, a?: string | RegExp | FindAllOptions, b?: FindAllOptions): Promise<iValue<cheerio.Element>[]>;
getAncestorOrSelf(selector: string): ValuePromise;
getFirstChild(selector: string): ValuePromise;
getLastChild(selector: string): ValuePromise;
getChildren(selector?: string): Promise<HTMLElement[]>;
getSiblings(selector: string): Promise<iValue<cheerio.Element>[]>;
getFirstSibling(selector: string): ValuePromise;
getLastSibling(selector: string): ValuePromise;
getAncestor(selector?: string): ValuePromise;
getParent(): ValuePromise;
getPreviousSibling(selector?: string): ValuePromise;
getPreviousSiblings(selector?: string): Promise<HTMLElement[]>;
getNextSibling(selector?: string): ValuePromise;
getNextSiblings(selector?: string): Promise<HTMLElement[]>;
click(): ValuePromise;
fillForm(attributeName: string, formData: KeyValue): ValuePromise;
fillForm(formData: KeyValue): ValuePromise;
submit(): ValuePromise;
protected _getText(): Promise<string>;
protected _getValue(): Promise<any>;
protected _getProperty(key: string): Promise<any>;
protected _getInnerText(): Promise<string>;
protected _getInnerHtml(): Promise<string>;
protected _getOuterHtml(): Promise<any>;
protected _getClassName(): Promise<string>;
protected _getTagName(): Promise<string>;
protected _getAttribute(key: string): Promise<string | null>;
}