How to scroll down with sikuli

Jazz picture Jazz · Jun 28, 2017 · Viewed 11.2k times · Source

How to scroll down with Sikuli in Selenium Eebdriver with java?

I am using screen.wheel(1 , 8); in my code to scroll down in an open window.

Sometimes it works fine but after running my script 4-5 times it behaves differently. Instead of scrolling vertically it starts scrolling horizontally.

s.doubleClick("C:\\SikuliX\\Images\\C_Drive.png");
s.wheel( 1, 8); 
s.doubleClick("C:\\SikuliX\\Images\\DestinFolder.png");
s.doubleClick("C:\\SikuliX\\Images\\CfgFolder.png")

Please help and let me know how I can move the scrollbar vertically for specific steps and in particular window.

Answer

Assi.NET picture Assi.NET · Jul 5, 2017

You can simply use shortcuts:

Windows Example:

type(Key.PAGE_DOWN) - scroll down 1 time
type(Key.PAGE_UP) - scroll up 1 time

Also if you want to repeat it a few times:

type(Key.PAGE_DOWN*3) - scroll down 3 times

MAC Example:

type(Key.DOWN, KeyModifier.CMD) - scroll all the way down