Scroll Up in web ui katalon

Hello guys, I want to ask about scrollUp, is in katalon we can scroll up to find the element? for example :


in this web I want to click button filter “Paling sesuai” , but the button is to high to reach for automation. I try to use WebUI.scrollToPosition(5, 0) is only to scrollDown.

Thank you!

2 Likes

Have you tried WebUI.scrollToElement ?

1 Like

yes I’ve tried but it doesnt work . the automation can’t scroll up to the top


line 39

1 Like

Hi @tioagung92, Would something like this help you?
Copy all of the following to a new test case and then run it.

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.openBrowser('')
WebUI.navigateToUrl('https://en.wikipedia.org/wiki/Main_Page')

//Scroll to bottom of page
WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, document.body.scrollHeight);', null)

//Scroll to Top of page
WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, -document.body.scrollHeight);', null)

//Scroll midway on page
WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, 1200);', null)

//Scroll to top of page
WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, 0);', null)

//Scroll to bottom of page
WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, 999999);', null)
3 Likes

is null need to change or not ?

1 Like

Hi @tioagung92, Did you try the example?
Nothing needs to change.

1 Like