Full Web Page Screenshot
Takes a screen capture of an entire web page.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Takes a screen capture of an entire web page and saves the image to a .jpg
or .pdf
file.
Script syntax
IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
webCapture --format(CaptureFormat) [--savedirectory(String)] [--filename(String)]
Dependencies
Before using the Get Image from the Web (webGetImage
) command, use the Start Browser (webStart
) command to start a browser. Or use the Find Internet Explorer Browser (findBrowser
) command to attach the Microsoft™ Internet Explorer.
Input parameter
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Save format | format |
Required |
CaptureFormat |
Format for saving the file. See the format parameter options. |
Destination directory | saveddirectory |
Optional |
Text |
Directory path to save the file. |
File name | filename |
Optional |
Text |
The file name. |
Force Enable Scroll | forcescroll |
Optional |
Boolean |
Enable to change the page's source code to enable body scroll. This option changes the element to automatically adjust its height so the content can be fully displayed on the screen and the element can be clipped correctly. This change might affect the page's appearance while the command runs. Because of this, some elements in the page structure might not be displayed correctly. |
format
parameter options
The following table displays the options available for the format
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Image | Image |
The screen capture in JPEG format. |
Pdf |
The screen capture in PDF format. |
Example
After starting the browser, you get a screen capture of the full web page from the IBM web page.
defVar --name desktopPath --type String
// Gets the path of the user's desktop directory
getSpecialFolder --folder "Desktop" desktopPath=value
webStart --name browser --type "Chrome"
// Navigate to the IBM web page
webNavigate --url "https://www.ibm.com"
//Gets the image of the entire loaded page and saves it on the desktop
webCapture --format "Pdf" --savedirectory "${desktopPath}" --filename ibm_web_page
webClose --name browser
Limitations
This command can only obtain the full web page if the scrollbar is defined in the <body>
tag.