Nexial Automation

Test Automation Platform for everyone!

X

web » screenshot(file,locator,removeFixed)

Description

This command automates the screen capture (to file) of a Web element denoted by locator. If the locator resolves to multiple web element, then only the first one is considered.

Some web pages might contain persistent (“sticky”) navigation elements on the top or bottom of a page. While Nexial is scrolling the target web element during screenshot capturing, the persistent element would continue to appear. To circumvent such issue, one can specify the removeFixed parameter as true to activate additional automation in Nexial. When removeFixed parameter is set to true, Nexial will attempt to find any existing persistent navigation (either top or bottom of the page) and disable its positional persistence. After screenshot capturing is complete, Nexial will restore the page navigation’s positional persistence.

Note:

  • If nexial.outputToCloud System variable is set to true, then the captured image will be uploaded to the cloud as well.
  • screen capturing can be disabled for the entire execution via nexial.screenshotEnabled System variable.

Parameters

  • file - the screen capture saved as a file.
  • locator - this parameter is the locator of the element.
  • removeFixed - true if Nexial should temporarily disable persistent navigation placements while performing screen capturing.

Example

Suppose we want to capture element image from acousticguitar.com:

Script:

The captured image:

See Also