Class: PuppeteerAdapter
@mugshot/puppeteer.PuppeteerAdapter
Webdriver adapter over Puppeteer to be used with WebdriverScreenshotter.
example
#
Implements#
Constructors#
constructor+ new PuppeteerAdapter(page
: Page): PuppeteerAdapter
#
Parameters:Name | Type | Description |
---|---|---|
page | Page | The return value of newPage() . |
Returns: PuppeteerAdapter
Defined in: packages/puppeteer/src/index.ts:26
#
Methods#
execute▸ execute<R, A>(func
: (...args
: A) => R, ...args
: A): Promise<any>
Execute a function in the current page context.
#
Type parameters:Name | Type |
---|---|
R | - |
A | any[] |
#
Parameters:Name | Type |
---|---|
func | (...args : A) => R |
...args | A |
Returns: Promise<any>
Implementation of: Webdriver.execute
Defined in: packages/puppeteer/src/index.ts:66
#
getElementRect▸ getElementRect(selector
: string): Promise<null
| { height
: number = 0; width
: number = 0; x
: number = 0; y
: number = 0 } | { height
: number = 0; width
: number = 0; x
: number = 0; y
: number = 0 }[]>
Get the dimensions and coordinates of an element.
#
Parameters:Name | Type |
---|---|
selector | string |
Returns: Promise<null
| { height
: number = 0; width
: number = 0; x
: number = 0; y
: number = 0 } | { height
: number = 0; width
: number = 0; x
: number = 0; y
: number = 0 }[]>
Implementation of: Webdriver.getElementRect
Defined in: packages/puppeteer/src/index.ts:32
#
setViewportSize▸ setViewportSize(width
: number, height
: number): Promise<void>
Set the size of the viewport (meaning window minus chrome).
This is unlike setWindowRect which doesn't take the chrome into account.
#
Parameters:Name | Type |
---|---|
width | number |
height | number |
Returns: Promise<void>
Implementation of: Webdriver.setViewportSize
Defined in: packages/puppeteer/src/index.ts:54
#
takeViewportScreenshot▸ takeViewportScreenshot(): Promise<string>
Take a viewport screenshot and return a base64 string.
Returns: Promise<string>
Implementation of: Webdriver.takeViewportScreenshot
Defined in: packages/puppeteer/src/index.ts:60