- async close(pageUrl)
Closes the browser window where the specified web page is opened.
- async getBrowserInfo(browser) ⇒
BrowserInfo
Returns information about the specified browser.
- async getInstallations() ⇒
Object.<string, BrowserInfo>
Returns the list of the BrowserInfo objects that contain information about the browsers installed on the machine.
- getViewportSize(deviceName) ⇒
DeviceViewportSize
Gets the viewport size for the specified device.
- isValidDeviceName(inputString) ⇒
boolean
Checks if the provided string is a valid device name contained in the screen size database.
- async open(browserInfo, pageUrl)
Opens the web page in a new instance of the browser.
- async resize(pageUrl, currentWidth, currentHeight, width, height)
Changes the browser's client area size to the new width and height.
- async screenshot(pageUrl, screenshotPath)
Takes a screenshot of the browser window where the specified web page is opened.
- BrowserInfo :
Object
Object that contains information about the browser installed on the machine.
- DeviceViewportSize :
Object
Defines the size of a device viewport.
Kind: global async function
Param | Type | Description |
---|---|---|
pageUrl | string |
Specifies the URL of the web page opened in the browser. |
async getBrowserInfo(browser) ⇒ BrowserInfo
Returns information about the specified browser.
Kind: global async function
Returns: BrowserInfo
- An object that contains information about the specified browser.
Param | Type | Description |
---|---|---|
browser | string |
A browser alias ('chrome', 'ff', etc.) or a path to the browser's executable file. |
Returns the list of the BrowserInfo objects that contain information about the browsers installed on the machine.
Kind: global async function
Returns: Object.<string, BrowserInfo>
- List of the BrowserInfo objects
containing information about the browsers installed on the machine.
Example
{
chrome: {
path: 'C:\\ProgramFiles\\...\\chrome.exe',
cmd: '--new-window',
macOpenCmdTemplate: 'open -n -a "{{{path}}}" --args {{{pageUrl}}} {{{cmd}}}'
},
firefox: {
path: 'C:\\ProgramFiles\\...\\firefox.exe',
cmd: '-new-window',
macOpenCmdTemplate: 'open -a "{{{path}}}" {{{pageUrl}}} --args {{{cmd}}}'
}
}
getViewportSize(deviceName) ⇒ DeviceViewportSize
Gets the viewport size for the specified device.
Kind: global function
Returns: DeviceViewportSize
- The size of the device viewport.
Param | Type | Description |
---|---|---|
deviceName | string |
Specifies the name of the target device. Use values from the Device Name column of this table. |
Checks if the provided string is a valid device name contained in the screen size database.
Kind: global function
Returns: boolean
- true
if the specified string is a valid device name.
Param | Type | Description |
---|---|---|
inputString | string |
The string to be validated. |
Opens the web page in a new instance of the browser.
Kind: global async function
Param | Type | Description |
---|---|---|
browserInfo | BrowserInfo |
Provides information on the browser where the web page should be opened. |
pageUrl | string |
Specifies the web page URL. |
Changes the browser's client area size to the new width and height.
Kind: global async function
Param | Type | Description |
---|---|---|
pageUrl | string |
Specifies the URL of the web page opened in the browser. |
currentWidth | number |
Specifies the current width of the browser's client area, in pixels. Use the window.innerWidth property to determine it. |
currentHeight | number |
Specifies the current height of the browser's client area, in pixels. Use the window.innerHeight property to determine it. |
width | number |
Specifies the new client area width, in pixels. |
height | number |
Specifies the new client area height, in pixels. |
Takes a screenshot of the browser window where the specified web page is opened.
Kind: global async function
Param | Type | Description |
---|---|---|
pageUrl | string |
Specifies the URL of the web page opened in the browser. |
screenshotPath | string |
Specifies the full path to the screenshot file. For example, D:\Temp\chrome-screenshot.jpg. |
Object that contains information about the browser installed on the machine.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
path | string | undefined |
The path to the executable file that starts the browser. Required on MacOS machines. On Windows machines, it is used when the winOpenCmdTemplate property is undefined. |
cmd | string |
Additional command line parameters. |
macOpenCmdTemplate | string |
A Mustache template that provides parameters for launching the browser on a MacOS machine. |
winOpenCmdTemplate | string | undefined |
A Mustache template that provides parameters for launching the browser on a Windows machine. If undefined, the path to the executable file specified by the path property is used. |
Example
{
path: 'C:\\ProgramFiles\\...\\firefox.exe',
cmd: '-new-window',
macOpenCmdTemplate: 'open -a "{{{path}}}" {{{pageUrl}}} --args {{{cmd}}}'
}
Defines the size of a device viewport.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
portraitWidth | number |
The viewport width in portrait orientation. |
landscapeWidth | number |
The viewport width in landscape orientation. |