Class: PlaywrightAdapter
@mugshot/playwright.PlaywrightAdapter
Adapter over Playwright to be used with WebdriverScreenshotter.
example
#
Implements#
Constructors#
constructor+ new PlaywrightAdapter(page
: Page): PlaywrightAdapter
#
Parameters:Name | Type | Description |
---|---|---|
page | Page | The return value of newPage() . |
Returns: PlaywrightAdapter
Defined in: packages/playwright/src/index.ts:27
#
Methods#
execute▸ execute<R, A>(func
: (...args
: A) => R, ...args
: A): Promise<R>
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<R>
Implementation of: Webdriver.execute
Defined in: packages/playwright/src/index.ts:36
#
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/playwright/src/index.ts:46
#
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/playwright/src/index.ts:60
#
takeViewportScreenshot▸ takeViewportScreenshot(): Promise<string>
Take a viewport screenshot and return a base64 string.
Returns: Promise<string>
Implementation of: Webdriver.takeViewportScreenshot
Defined in: packages/playwright/src/index.ts:33