[@types/puppeteer] Add evaluateHandle, focus, hover, tap, type to Frame definition (#25508)

* Add evaluateHandle, focus, hover, tap, type to Frame definition

* Removing duplicated methods
This commit is contained in:
Stefano Orlando
2018-05-05 01:10:31 +02:00
committed by Andy
parent bfc59df972
commit e94c84bd5e

View File

@@ -804,6 +804,15 @@ export interface FrameBase {
/** Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the content. */
addStyleTag(options: StyleTagOptions): Promise<void>;
/**
* This method fetches an element with selector, scrolls it into view if needed, and
* then uses `page.mouse` to click in the center of the element. If there's no element
* matching selector, the method throws an error.
* @param selector A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
* @param options Specifies the click options.
*/
click(selector: string, options?: ClickOptions): Promise<void>;
/** Gets the full HTML contents of the page, including the doctype. */
content(): Promise<string>;
@@ -819,15 +828,55 @@ export interface FrameBase {
...args: any[]
): Promise<any>;
/**
* Evaluates a function in the page context.
* If the function, passed to the page.evaluateHandle, returns a Promise, then page.evaluateHandle
* would wait for the promise to resolve and return its value.
* @param fn The function to be evaluated in the page context.
* @param args The arguments to pass to the `fn`.
* @returns A promise which resolves to return value of `fn`.
*/
evaluateHandle(
fn: EvaluateFn,
...args: any[]
): Promise<JSHandle>;
/** This method fetches an element with selector and focuses it. */
focus(selector: string): Promise<void>;
/**
* This method fetches an element with `selector`, scrolls it into view if needed,
* and then uses page.mouse to hover over the center of the element. If there's no
* element matching `selector`, the method throws an error.
* @param selector A selector to search for element to hover. If there are multiple elements satisfying the selector, the first will be hovered.
*/
hover(selector: string): Promise<void>;
/**
* Sets the page content.
* @param html HTML markup to assign to the page.
*/
setContent(html: string): Promise<void>;
/**
* This method fetches an element with `selector`, scrolls it into view if needed,
* and then uses page.touchscreen to tap in the center of the element.
* @param selector A `selector` to search for element to tap. If there are multiple elements
* satisfying the selector, the first will be tapped.
*/
tap(selector: string): Promise<void>;
/** Returns page's title. */
title(): Promise<string>;
/**
* Sends a `keydown`, `keypress/input`, and `keyup` event for each character in the text.
* @param selector A selector of an element to type into. If there are multiple elements satisfying the selector, the first will be used.
* @param text: A text to type into a focused element.
* @param options: The typing parameters.
*/
type(selector: string, text: string, options?: { delay: number }): Promise<void>;
/** Returns frame's url. */
url(): string;
@@ -942,15 +991,6 @@ export interface Page extends EventEmitter, FrameBase {
/** Brings page to front (activates tab). */
bringToFront(): Promise<void>;
/**
* This method fetches an element with selector, scrolls it into view if needed, and
* then uses `page.mouse` to click in the center of the element. If there's no element
* matching selector, the method throws an error.
* @param selector A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
* @param options Specifies the click options.
*/
click(selector: string, options?: ClickOptions): Promise<void>;
/** Closes the current page. */
close(): Promise<void>;
@@ -1007,9 +1047,6 @@ export interface Page extends EventEmitter, FrameBase {
*/
exposeFunction(name: string, puppeteerFunction: (...args: any[]) => any): Promise<void>;
/** This method fetches an element with selector and focuses it. */
focus(selector: string): Promise<void>;
/** An array of all frames attached to the page. */
frames(): Frame[];
@@ -1032,14 +1069,6 @@ export interface Page extends EventEmitter, FrameBase {
*/
goto(url: string, options?: Partial<NavigationOptions>): Promise<Response | null>;
/**
* This method fetches an element with `selector`, scrolls it into view if needed,
* and then uses page.mouse to hover over the center of the element. If there's no
* element matching `selector`, the method throws an error.
* @param selector A selector to search for element to hover. If there are multiple elements satisfying the selector, the first will be hovered.
*/
hover(selector: string): Promise<void>;
/** Returns the virtual keyboard. */
keyboard: Keyboard;
@@ -1151,14 +1180,6 @@ export interface Page extends EventEmitter, FrameBase {
*/
setViewport(viewport: Viewport): Promise<void>;
/**
* This method fetches an element with `selector`, scrolls it into view if needed,
* and then uses page.touchscreen to tap in the center of the element.
* @param selector A `selector` to search for element to tap. If there are multiple elements
* satisfying the selector, the first will be tapped.
*/
tap(selector: string): Promise<void>;
/** @returns The target this page was created from */
target(): Target;
@@ -1171,14 +1192,6 @@ export interface Page extends EventEmitter, FrameBase {
/** Returns the tracing object. */
tracing: Tracing;
/**
* Sends a `keydown`, `keypress/input`, and `keyup` event for each character in the text.
* @param selector A selector of an element to type into. If there are multiple elements satisfying the selector, the first will be used.
* @param text: A text to type into a focused element.
* @param options: The typing parameters.
*/
type(selector: string, text: string, options?: { delay: number }): Promise<void>;
/**
* The page's URL. This is a shortcut for `page.mainFrame().url()`
*/