Browser-Screenshot
Command Description
Browser screenshot
Command Prototype
WebBrowser.ScreenShot(hWeb,sPath,objRect,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
hWeb | True | expression | hWeb | Browser handle string using WebBrowser.create or WebBrowser.bind Command Returns |
sPath | True | path | '''C:\Users''' | The path where the screenshot was saved |
objRect | True | dictionary | {"x": 0, "y": 0, "width": 0, "height": 0} | The rectangle area the screenshot, if null, capture the display area of the entire browser |
bContinueOnError | None | boolean | None | Specify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 200 | The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds |
Demo
/************************************Browser screenshot************* ****************************
Command prototype:
WebBrowser.ScreenShot(hWeb,sPath,objRect,optionArgs)
Input parameters:
hWeb--Browser object
sPath--the file path where screenshots are saved to
objRect--The rectangular range of the screenshot, if passed as null , the entire browser display area will be captured
bContinueOnError--whether to continue after error
iDelayAfter-- delay after execution
iDelayBefore--delay before execution
*********************************************************************************/
Dim hWeb,bRet
hWeb = WebBrowser.Create("ie","www.baidu.com",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
TracePrint(hWeb)
hWeb = WebBrowser.BindBrowser("ie",10000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
TracePrint(hWeb)
WebBrowser.ScreenShot(hWeb,'''C:\Users\DVA\OneDrive\Pictures\屏幕快照\dddd.png''',{"x": 500, "y": 500, "width": 0, "height": 0},{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})