how to move the scroll bar in a page

2,482 views
Skip to first unread message

Srinadh

unread,
Apr 6, 2012, 12:04:25 AM4/6/12
to qtp-ele...@googlegroups.com
Hi All

I have come across the following scenario and need your help.
Scenario: I have a small scroll bar(not the page scroll bar) in a registration page which an user needs to scroll it down till end to enable submit button.

Tried the following so far:

1. Analog recording
2. Low level recording
Above methods are working fine, but not efficient i reckon.

is there any other way i can automate this process using VB script? like using sendkeys - click on the scroll bar and drag it till the end.
Your guidance will be much appreciated.


Thanks
Srinadh

Jitendra.S

unread,
Apr 6, 2012, 1:20:39 PM4/6/12
to qtp-ele...@googlegroups.com
If you are on the same page (page with scroll bar and Submit button) then
I think No need to use scroll bar U can directly identify submit button using DP and click on it..

If its not work pls share .

~J~
Message has been deleted

Srinadh

unread,
Apr 6, 2012, 9:51:26 PM4/6/12
to qtp-ele...@googlegroups.com
Submit button wont be enabled until we move the scroll bar down.
Yes its work related, sorry cant share it.

I have tried sendkeys{DOWN}, its working fine but i have to use a loop to bring the scroll bar down.
I am looking for something like this: click on the scroll bar and drag it to the bottom(like a mouse operation).

madhu

unread,
Apr 8, 2012, 12:51:06 AM4/8/12
to Srinadh, qtp-ele...@googlegroups.com

Hi Srinadh,


Could you please try the below code? Not sure whether the small scroll bar is in a different frame. Please check that. 


'For page up

Set bodyObj=Browser("title:=.*").Page("title:=.*").Object.body

bodyObj.doScroll("pageUp")

 

'For page down

Set bodyObj=Browser("title:=.*").Page("title:=.*").Object.body

bodyObj.doScroll("pageDown")

 

(Or) Using Send Keys method:


'For page up

Set shellObj=CreateObject("WScript.Shell")

shellObj.SendKeys "{PGUP}"

 

'For page down

Set shellObj=CreateObject("WScript.Shell")

shellObj.SendKeys "{PGDN}"

Regards,

Madhu





--

Regards,

Madhu


Jitendra.S

unread,
Apr 9, 2012, 11:15:32 AM4/9/12
to qtp-ele...@googlegroups.com

Try this ..Here We are automating Mousewheel using loop..

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

--











~J~

Srinadh

unread,
Apr 10, 2012, 5:35:11 AM4/10/12
to qtp-ele...@googlegroups.com
Hi Guys

Thank you so much for your help. Here is the code which is working as i expected.

Set obj=CreateObject("Mercury.DeviceReplay")
set wS = CreateObject("WScript.Shell")

Set vE = Browser(vB).page(vP).WebElement(vS)
vX = vE.GetROProperty("abs_x")
vY = vE.GetROProperty("abs_y") 'Scrolling mouse obj.MouseClick vX+650, vY+25, 2 wS.SendKeys "{DOWN}" wS.SendKeys "{DOWN}" wS.SendKeys "{DOWN}" wS.SendKeys "{ENTER}"

Reply all
Reply to author
Forward
0 new messages