Micro Focus QTP (UFT) Forums
Moving scroll bar up and down by QTP in web page - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Moving scroll bar up and down by QTP in web page (/Thread-Moving-scroll-bar-up-and-down-by-QTP-in-web-page)



Moving scroll bar up and down by QTP in web page - srinibarati - 05-07-2010

Hi,

I have to move the scroll bar of web page either up or down to make the required object visible.

I have used the below code but nothing is happening.

Code:
Browser("BrowserCellPhones").Page("PhonesPage").Object.body.doscroll "scrollbarPageUp"

Kindly help me whats wrong with the code I have used.

Regards,
Srini


RE: Moving scroll bar up and down by QTP in web page - guin.anirban - 05-07-2010

If scroll bar script does not work then use "Send Keys" method of WSH.


RE: Moving scroll bar up and down by QTP in web page - srinibarati - 05-07-2010

Thanks.

Below code is working perfectly.

Code:
Set Obj=Browser("BrowserCellPhones").Page("PhonesPage").Object.body
Obj.doScroll("pageUp")

Regards,
Srini


RE: Moving scroll bar up and down by QTP in web page - basanth27 - 05-11-2010

Not sure if this intrests you..

Code:
Extern.Declare micVoid, "mouse_event", "user32.dll", "mouse_event", micLong, micLong, micLong, micLong, micLong
Const MOUSEEVENTF_WHEEL = 2048 '@const long | MOUSEEVENTF_WHEEL | middle button up
Const POSWHEEL_DELTA = 120 '@const long | POSWHEEL_DELTA | movement of 1 mousewheel click Down<nl>
Const NEGWHEEL_DELTA = -120 '@const long | NEGWHEEL_DELTA | movement of 1 mousewheel click Up<nl>

Sub MouseWheelRot(iClicks)

dim iLoop
dim bPos

if iClicks > 0 then
bPos = true
end if
for iLoop = 1 to abs(iClicks)
if bPos then
Extern.mouse_event MOUSEEVENTF_WHEEL,0,0,POSWHEEL_DELTA,0
else
Extern.mouse_event MOUSEEVENTF_WHEEL,0,0,NEGWHEEL_DELTA,0
end if
next
End Sub

The above function causes the mousewheel to rotate...i have used this long ago..but i guess -5 would be the end of the rotation.