Scroll until

Asked by DH on 2021-04-29

Hi,
sorry for this post. I've red many answers in this matter here on Launchpad but still I cant't get it working.

So I need to scroll until bottom of scroll.

This is what I've tried:

while True:
   if not exists(complete_scroll):
       break
   else:
       click(down_arrow)
   wait(1)

The problem is that the loop continues forever.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
Last query:
Last reply:
Manfred Hampl (m-hampl) said : #1

What is complete_scroll? Is this an image that shows that you are at the end?

In that case your "if" statement is the wrong way round and probably must be

while True:
   if exists(complete_scroll):
       break
   else:
       click(down_arrow)
   wait(1)

Additional idea:
Is there a way to use a keyboard shortcut (e.g. Ctrl+End) to scroll down to the end?

DH (dh72) said : #2

Hi,
"complete_scroll" is an image at the end of scroll in browser.

Tried your solution but Sikuli only clicked one time on scroll and exited.

Best masuo (masuo-ohara) said : #3

Let's recognize where sikuli find the image(complete scroll) on the screen.
Insert this codes after "while True" and run script, you will find out where it is.
If it's an unexpected location, try changing the image or changing the similarity.

m = exists(complete scroll)
if m:
    m.highlight(3)

DH (dh72) said : #4

Thanks masuo, that solved my question.