| Method | Arguments | description |
|---|---|---|
launchBrowser |
no argument | Launches a browser instance with GlobalOptions. The browser will be closed when the parent node.js process is closed |
init |
TestOptions | Launches a browser instance if there is no instance already been launched or launches new browser window if newWindow:true |
cleanup |
no argument | Closes browser instance if it is not closed already |
| name | type | value |
|---|---|---|
goto |
string |
Url |
wait |
string, integer or func |
waiting time in millisecond or waiting for a selector or waiting until the function you supplied is evaluated as true |
execute |
func or string |
execute an expression in the browser context |
freezeImage |
string |
Selector name of a |
capture |
object |
screenshot options |
resize |
object |
viewport |
toMatchSnapshot |
null |
To support jest snapshot testing. This is not tested for other test frameworks |
options<[Object]> Options object which might have the following properties:path<[string]> The file path to save the image to. The screenshot type will be inferred from file extension. Ifpathis a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk.type<[string]> Specify screenshot type, can be eitherjpegorpng. Defaults to 'png'.quality<[number]> The quality of the image, between 0-100. Not applicable topngimages.fullPage<[boolean]> When true, takes a screenshot of the full scrollable page. Defaults tofalse.clip<[Object]> An object which specifies clipping region of the page. Should have the following fields:x<[number]> x-coordinate of top-left corner of clip areay<[number]> y-coordinate of top-left corner of clip areawidth<[number]> width of clipping areaheight<[number]> height of clipping area
omitBackground<[boolean]> Hides default white background and allows capturing screenshots with transparency. Defaults tofalse.
viewport<[Object]>width<[number]> page width in pixels.height<[number]> page height in pixels.deviceScaleFactor<[number]> Specify device scale factor (can be thought of as dpr). Defaults to1.isMobile<[boolean]> Whether themeta viewporttag is taken into account. Defaults tofalse.hasTouch<[boolean]> Specifies if viewport supports touch events. Defaults tofalseisLandscape<[boolean]> Specifies if viewport is in landscape mode. Defaults tofalse.
- click
- setCookie
- deleteCookie
- emulate (Emulates phone)
- ...