@types/puppeteer
Advanced tools
Comparing version 0.12.0 to 0.12.1
// Type definitions for puppeteer 0.12 | ||
// Project: https://github.com/GoogleChrome/puppeteer#readme | ||
// Definitions by: Marvin Hagemeister <https://github.com/marvinhagemeister> | ||
// Christopher Deutsch <https://github.com/cdeutsch> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -10,4 +11,6 @@ // TypeScript Version: 2.3 | ||
export interface Keyboard { | ||
down(key: string, options?: { text: string }): Promise<void>; | ||
down(key: string, options?: { text?: string }): Promise<void>; | ||
press(key: string, options?: { text?: string, delay?: number }): Promise<void>; | ||
sendCharacter(char: string): Promise<void>; | ||
type(text: string, options?: { delay?: number }): Promise<void>; | ||
up(key: string): Promise<void>; | ||
@@ -45,2 +48,10 @@ } | ||
export interface ConsoleMessage { | ||
args: JSHandle[]; | ||
text: string; | ||
type: 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | | ||
'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | | ||
'profile' | 'profileEnd' | 'count' | 'timeEnd'; | ||
} | ||
export type PageEvents = | ||
@@ -104,3 +115,3 @@ | "console" | ||
export type EvaluateFn<T> = (elem?: ElementHandle) => Promise<T>; | ||
export type EvaluateFn = string | ((...args: any[]) => any); | ||
@@ -155,11 +166,12 @@ export interface NavigationOptions { | ||
fullPage?: boolean; | ||
clip?: { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
}; | ||
clip?: BoundingBox; | ||
omitBackground?: boolean; | ||
} | ||
export interface TagOptions { | ||
url?: string; | ||
path?: string; | ||
content?: string; | ||
} | ||
export interface PageFnOptions { | ||
@@ -170,10 +182,59 @@ polling?: "raf" | "mutation" | number; | ||
export interface ElementHandle { | ||
export interface BoundingBox { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
} | ||
export interface ElementHandle extends JSHandle { | ||
boundingBox(): BoundingBox; | ||
click(options?: ClickOptions): Promise<void>; | ||
dispose(): Promise<void>; | ||
focus(): Promise<void>; | ||
hover(): Promise<void>; | ||
press(key: string, options?: { text?: string, delay?: number }): Promise<void>; | ||
screenshot(options?: ScreenshotOptions): Promise<Buffer>; | ||
tap(): Promise<void>; | ||
toString(): string; | ||
type(selector: string, text: string, options?: { delay: number }): Promise<void>; | ||
uploadFile(...filePaths: string[]): Promise<void>; | ||
} | ||
export interface ExecutionContext { | ||
evaluate( | ||
fn: EvaluateFn, | ||
...args: any[] | ||
): Promise<any>; | ||
evaluateHandle( | ||
fn: EvaluateFn, | ||
...args: any[] | ||
): Promise<JSHandle>; | ||
queryObjects(prototypeHandle: JSHandle): JSHandle; | ||
} | ||
export interface JSHandle { | ||
asElement(): ElementHandle; | ||
dispose(): Promise<void>; | ||
executionContext(): ExecutionContext; | ||
getProperties(): Promise<Map<string, JSHandle>>; | ||
getProperty(propertyName: string): Promise<JSHandle>; | ||
jsonValue(): Promise<any>; | ||
} | ||
export interface Metrics { | ||
Timestamp: number; | ||
Documents: number; | ||
Frames: number; | ||
JSEventListeners: number; | ||
Nodes: number; | ||
LayoutCount: number; | ||
RecalcStyleCount: number; | ||
LayoutDuration: number; | ||
RecalcStyleDuration: number; | ||
ScriptDuration: number; | ||
TaskDuration: number; | ||
JSHeapUsedSize: number; | ||
JSHeapTotalSize: number; | ||
} | ||
export type Headers = Record<string, string>; | ||
@@ -224,3 +285,3 @@ export type HttpMethod = | ||
headers: Headers; | ||
json(): Promise<object>; | ||
json(): Promise<any>; | ||
ok: boolean; | ||
@@ -233,17 +294,20 @@ request(): Request; | ||
export type Serializable = boolean | number | string | object; | ||
export interface FrameBase { | ||
$(selector: string): Promise<ElementHandle>; | ||
$$(selector: string): Promise<ElementHandle[]>; | ||
$$eval( | ||
selector: string, | ||
fn: (...args: any[]) => void | ||
): Promise<any>; | ||
$eval( | ||
selector: string, | ||
fn: (...args: Array<Serializable | ElementHandle>) => void | ||
): Promise<Serializable>; | ||
addScriptTag(url: string): Promise<void>; | ||
fn: (...args: any[]) => void | ||
): Promise<any>; | ||
addScriptTag(options: TagOptions): Promise<void>; | ||
addStyleTag(options: TagOptions): Promise<void>; | ||
injectFile(filePath: string): Promise<void>; | ||
evaluate<T = string>( | ||
fn: T | EvaluateFn<T>, | ||
...args: Array<object | ElementHandle> | ||
): Promise<T>; | ||
evaluate( | ||
fn: EvaluateFn, | ||
...args: any[] | ||
): Promise<any>; | ||
title(): Promise<string>; | ||
@@ -255,3 +319,4 @@ url(): string; | ||
selectorOrFunctionOrTimeout: string | number | Function, | ||
options?: object | ||
options?: any, | ||
...args: any[] | ||
): Promise<void>; | ||
@@ -265,3 +330,2 @@ waitForFunction( | ||
): Promise<void>; | ||
waitForNavigation(options?: NavigationOptions): Promise<Response>; | ||
waitForSelector( | ||
@@ -275,2 +339,3 @@ selector: string, | ||
childFrames(): Frame[]; | ||
executionContext(): ExecutionContext; | ||
isDetached(): boolean; | ||
@@ -282,3 +347,3 @@ name(): string; | ||
export interface EventObj { | ||
console: string; | ||
console: ConsoleMessage; | ||
dialog: Dialog; | ||
@@ -290,2 +355,3 @@ error: Error; | ||
load: undefined; | ||
metrics: { title: string, metrics: any }; | ||
pageerror: string; | ||
@@ -299,3 +365,2 @@ request: Request; | ||
export interface Page extends FrameBase { | ||
on(event: "console", handler: (...args: any[]) => void): void; | ||
on<K extends keyof EventObj>( | ||
@@ -320,13 +385,18 @@ event: K, | ||
emulate(options: Partial<EmulateOptions>): Promise<void>; | ||
emulateMedia(mediaType: string | null): Promise<void>; | ||
emulateMedia(mediaType: 'screen' | 'print' | null): Promise<void>; | ||
evaluateHandle( | ||
fn: EvaluateFn, | ||
...args: any[] | ||
): Promise<JSHandle>; | ||
evaluateOnNewDocument( | ||
fn: EvaluateFn<string>, | ||
...args: object[] | ||
fn: EvaluateFn, | ||
...args: any[] | ||
): Promise<void>; | ||
// Argument `fn` can be an arbitrary function | ||
exposeFunction(name: string, fn: any): Promise<void>; | ||
exposeFunction(name: string, fn: (...args: any[]) => any): Promise<void>; | ||
focus(selector: string): Promise<void>; | ||
frames(): Frame[]; | ||
getMetrics(): Metrics; | ||
goBack(options?: Partial<NavigationOptions>): Promise<Response>; | ||
@@ -340,6 +410,6 @@ goForward(options?: Partial<NavigationOptions>): Promise<Response>; | ||
pdf(options?: Partial<PDFOptions>): Promise<Buffer>; | ||
plainText(): Promise<string>; | ||
press(key: string, options?: { text: string; delay: number }): Promise<void>; | ||
queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>; | ||
reload(options?: NavigationOptions): Promise<Response>; | ||
screenshot(options?: ScreenshotOptions): Promise<Buffer>; | ||
select(selector: string, ...values: string[]): Promise<void>; | ||
setContent(html: string): Promise<void>; | ||
@@ -355,4 +425,5 @@ setCookie(...cookies: Cookie[]): Promise<void>; | ||
tracing: Tracing; | ||
type(text: string, options?: { delay: number }): Promise<void>; | ||
type(selector: string, text: string, options?: { delay: number }): Promise<void>; | ||
viewport(): Viewport; | ||
waitForNavigation(options?: NavigationOptions): Promise<Response>; | ||
} | ||
@@ -402,2 +473,6 @@ | ||
userDataDir?: string; | ||
/** Specify environment variables that will be visible to Chromium. Defaults to process.env. */ | ||
env?: any; | ||
/** Whether to auto-open DevTools panel for each tab. If this option is true, the headless option will be set false. */ | ||
devtools?: boolean; | ||
} | ||
@@ -404,0 +479,0 @@ |
{ | ||
"name": "@types/puppeteer", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "TypeScript definitions for puppeteer", | ||
@@ -11,2 +11,7 @@ "license": "MIT", | ||
"githubUsername": "marvinhagemeister" | ||
}, | ||
{ | ||
"name": "Christopher Deutsch", | ||
"url": "https://github.com/cdeutsch", | ||
"githubUsername": "cdeutsch" | ||
} | ||
@@ -23,4 +28,4 @@ ], | ||
}, | ||
"typesPublisherContentHash": "458a24fcdf15bcd21fcffe3c24d85bf503058f4f27afcc4ac8d234e65a42070d", | ||
"typesPublisherContentHash": "4c251a5d3884c2b62340bdd209334347752708a35e49510b8436ca67bd422993", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 17 Oct 2017 16:09:51 GMT | ||
* Last updated: Wed, 25 Oct 2017 16:18:55 GMT | ||
* Dependencies: node | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Marvin Hagemeister <https://github.com/marvinhagemeister>. | ||
These definitions were written by Marvin Hagemeister <https://github.com/marvinhagemeister>, Christopher Deutsch <https://github.com/cdeutsch>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15557
430