ActiveWindow Class
Active window object
Item Index
Methods
- _logMethodCall
- _requestJSON
- activate
- alert
- areaScreenshot deprecated
- asyncExecute
- captureArea
- captureDocument
- captureViewPort
- close
- compareArea
- compareDocument
- compareViewPort
- documentScreenshot deprecated
- execute
- frame
- getActiveElement
- getElement
- getElements
- getId
- getPosition
- getScrollPosition
- getSize
- getSource
- getTitle
- hasElement
- id
- init
- init
- init
- maximize
- mouse
- navigator
- position
- resize
- revert
- revert
- revert
- saveScreenshot
- scrollBy
- scrollTo
- sendKeys
- takeScreenshot deprecated
- touch
- viewPortScreenshot deprecated
Methods
_requestJSON
-
method
-
path
-
[body]
Performs a context dependent JSON request for the current session. The result is parsed for errors.
Returns:
activate
()
Activate the current window
areaScreenshot
-
[x=0]
-
[y=0]
-
[width=document.width-x]
-
[height=document.height-y]
-
[options]
Captures a specific area of the document
Parameters:
-
[x=0]
Int optionalX-coordinate for area
-
[y=0]
Int optionalY-coordinate for area
-
[width=document.width-x]
Int optionalWidth of area to be captured
-
[height=document.height-y]
Int optionalHeight of area to be captured
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer
asyncExecute
-
script
-
[args]
Execute a script asynchronously on the browser.
Source should be either a function body as a string or a function. Keep in mind that if it is a function it will not have access to any variables from the node.js process.
captureArea
-
[x=0]
-
[y=0]
-
[width=document.width-x]
-
[height=document.height-y]
-
[options]
Captures a specific area of the document
Parameters:
-
[x=0]
Int optionalX-coordinate for area
-
[y=0]
Int optionalY-coordinate for area
-
[width=document.width-x]
Int optionalWidth of area to be captured
-
[height=document.height-y]
Int optionalHeight of area to be captured
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer
captureDocument
-
[options]
Captures the complete document
Parameters:
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer
captureViewPort
-
[options]
Captures the currently visible view-port
Parameters:
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer
close
()
Close the current window
compareArea
-
title
-
[x=0]
-
[y=0]
-
[width=document.width-x]
-
[height=document.height-y]
-
[options]
Compares an area of the document with a previous screenshot, showing differences between them
Parameters:
-
title
StringUnique title for comparison
-
[x=0]
Int optionalX-coordinate for area
-
[y=0]
Int optionalY-coordinate for area
-
[width=document.width-x]
Int optionalWidth of area to be captured
-
[height=document.height-y]
Int optionalHeight of area to be captured
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
[compare]
Object optionalOptions for the comparison. See Blink-Diff documentation.
-
[id=1]
Object optionalAdditional identifier to differentiate comparisons even more.
-
-
Returns:
Are the screenshots the same? (NULL if there is nothing to compare to)
compareDocument
-
title
-
[options]
Compares the document with a previous screenshot, showing differences between them
Parameters:
-
title
StringUnique title for comparison
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
[compare]
Object optionalOptions for the comparison. See Blink-Diff documentation.
-
[id=1]
Object optionalAdditional identifier to differentiate comparisons even more.
-
-
Returns:
Are the screenshots the same? (NULL if there is nothing to compare to)
compareViewPort
-
title
-
[options]
Compares the view-port with a previous screenshot, showing differences between them
Parameters:
-
title
StringUnique title for comparison
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
[compare]
Object optionalOptions for the comparison. See Blink-Diff documentation.
-
[id=1]
Object optionalAdditional identifier to differentiate comparisons even more.
-
-
Returns:
Are the screenshots the same? (NULL if there is nothing to compare to)
documentScreenshot
-
[options]
Captures the complete document
Parameters:
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer
execute
-
script
-
[args]
Execute a script on the browser and return the result.
Source should be either a function body as a string or a function. Keep in mind that if it is a function it will not have access to any variables from the node.js process.
Returns:
getElement
-
selector
-
[selectorType='css
Get an element via a selector. Will throw an error if the element does not exist.
Returns:
getElements
-
selector
-
[selectorType='css
Get elements via a selector.
Returns:
getId
()
String
Get the value of the element id. Should the id resolve to 'current', then it will request the actual id.
Returns:
init
-
horizontalPadding
Initialize the device-pixel-ratio determination, collecting information that need to be reverted later on and modifying the document for device-pixel-ratio data.
Parameters:
-
horizontalPadding
Int
init
-
horizontalPadding
Initializes the stitching determination. It gathers the current document state, and it will modify the document as needed.
Parameters:
-
horizontalPadding
Int
init
-
needsStitching
Initializes screenshots and gathers data to revert changes. This function will also gather information required for screenshots like dimensions of document and view-port.
Parameters:
-
needsStitching
Boolean
maximize
()
Maximize a window
revert
-
initData
Reverts all changes done to the document in the init
Parameters:
-
initData
ObjectData gathered during init-phase
revert
-
initData
Reverts changes done to the document during the screenshot process
Parameters:
-
initData
ObjectData gathered during init-phase
revert
-
initData
Revert changes done to the document during the init-phase
Parameters:
-
initData
ObjectData gathered during init-phase
saveScreenshot
-
path
-
[options.horizontalPadding=0]
-
[options.eachFn]
-
[options.completeFn]
-
[options.blockOuts]
-
[options.blockOutColor=black]
-
[options.wait=100]
-
[options]
Take a screenshot of the current page and save to a file
Parameters:
-
path
StringPath where the file should be saved to
-
[options.horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[options.eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[options.completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[options.blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[options.blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[options.wait=100]
Int optionalWait in ms before each screenshot
-
[options]
Object optional
scrollBy
-
[x=0]
-
[y=0]
Scrolls by a specific coordinate, relative to the current position
scrollTo
-
[x=0]
-
[y=0]
Scrolls to a specific coordinate
sendKeys
-
str
Type a string of characters into the browser
Note: Modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed.
Parameters:
-
str
String | Array.
takeScreenshot
-
[options]
Take a screenshot of the current page
Parameters:
-
[options]
Object optional
Returns:
Binary image buffer
viewPortScreenshot
-
[options]
Captures the currently visible view-port
Parameters:
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
Returns:
Binary image buffer