Skip to main content

Set-Scrollbar-Position

Command Description

Set the position (pixels) of the scrollbar on the page

Command Prototype

WebBrowser.SetScroll(hWeb,dictScrollPostion,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
hWebTrueexpressionhWebBrowser handle string using WebBrowser.create or WebBrowser.bind Command Returns
dictScrollPostionTrueexpression{"ScrollLeft": 0,"ScrollTop": 0}The new position where scrollbars are moved to. The element ScrollLeft indicates the position of the horizontal scrollbar, and the element ScrollTop indicates the position of the vertical scrollbar
bContinueOnErrorNonebooleanNoneSpecify 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
iDelayAfterNonenumber300Delay time (in milliseconds) after executing the activity is 300 milliseconds
iDelayBeforeNonenumber200The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds

Demo

/************************************Set scrollbar position************ **************************** 
Command prototype:
SetScroll(hWeb,dictScrollPostion,optionArgs)
Input parameters:
hWeb--Browser object
dictScrollPostion--the new position to which the scroll bar moves
bContinueOnError--error or whether to continue
iDelayAfter-- delay after execution
iDelayBefore--Delay before execution
*********************************************************************************/
Dim hWeb
hWeb = WebBrowser.Create("ie","www.baidu.com",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
TracePrint(hWeb)
Mouse.Action(@ui"块级元素<div>_","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
WebBrowser.SetScroll(hWeb,{"ScrollLeft": 0,"ScrollTop": 600},{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})