Cannot scroll the page due to Multiple scrollbars on same page.

Asked by Atul Desai

Hi,
I am automating a page where I am using following code to scroll down. The problem I am facing is when i try to scroll the center loc is plotted inside a grid, which already have some 5000+ entries and a scrollbar. So when the center location is plotted inside the grid i have to wait until all entries inside the grid are scrolled. Which result in unnecessary long execution time. is there any way by which I can scroll the page instead of the scrollbar of a grid.

def ScrollAction(var,wheelScrollValue,scrollDirection):
    if scrollDirection == "downSide":
        while not exists(var):
            loc = SCREEN.getCenter()
            wheel(loc, WHEEL_DOWN, wheelScrollValue)

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

this is the same behavior as you would have manually.

You have to define loc as the scroll point outside the grid, but inside the page.

Revision history for this message
Atul Desai (atuld) said :
#2

Hi RaiMan,

Is there any possible way to define the loc explicitly instead of loc = SCREEN.getCenter().

Thanks,
Atul

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

- use any characteristic image outside the grid, but on the page

scrollPoint = find(characteristic_image)

wheel(scrollpoint, WHEEL_DOWN, wheelScrollValue)

wheel will move the mouse to the center of the match region scrollPoint

or use any other method, to calculate a valid scroll point on the page, but outside the grid.
… but everything should be relative to something evaluated at runtime (e.g. the browser window) - do not use absolute coordinates.
(exception: one can use ref=selectRegion() while testing)

Revision history for this message
Atul Desai (atuld) said :
#4

Thanks RaiMan, that solved my question.