How to find and verify the large image using the scroll bar

Asked by UmaMaheshwarRao

I am in a situation where I need to find an Image on the screen. But the complete image can be seen only If I move the scroll bar.

How do I sync scroll bar movement and image using the find or any other findAll

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

img = "some-image.png" # the image to find
pos = Location(x, y) # a location inside the scrollable window
steps = 1 # to be adjusted to your needs
max = 100 # to be adjusted to your needs
found = None

while max > 0:
    wheel(pos, WHEEL_DOWN, steps)
    max -= steps
    if exists(img, 0):
        found = getLastMatch()
        break

if not found: print "not found"; exit(1)
click(found) # as an example

Revision history for this message
UmaMaheshwarRao (buma) said :
#2

Thanks,
My Apologies. I would have mentioned the system details :
Windows 7

When I tried the above script I didn't see any scroll bar movement. When I tried manually the wheel button to scroll scrolling works fine in the windows folders. But on the Browser ( Chrome) the scroll operation doesn't work.

I tried this on the sikuli IDE. But later i will be writing the same on java

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

Made a quick test with Chrome and the Sikuli Launchpad overview page.

Having the page opened in Chrome centered on the screen and being the frontmost window when script is running:

loc = SCREEN.getCenter()
wheel(loc, WHEEL_DOWN, 1)
wait(3)

this works.

Revision history for this message
UmaMaheshwarRao (buma) said :
#4

Thanks RaiMan, that solved my question.

Revision history for this message
youssef ben (youssef-bennis) said :
#5

How to get the constant WHEEL_DOWN in Java, from which class?
thkx

Revision history for this message
youssef ben (youssef-bennis) said :
#6

found my answear : Button.WHEEL_DOWN
Thkx