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!

Have you tried WebUI.scrollToElement ?

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


line 39

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)

is null need to change or not ?

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

Hi Dave,
i need to top page,
this works.

Thanks

Hi @achmad.hidayat, Glad to hear it…
Can you set this ticket to solved.
Thanks Dave!

Hi @Dave_Evers ,
I’m sorry, I don’t have permission to solve or close this ticket :pray:
I think just @tioagung92 can do

Thanks @Dave_Evers

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

It looks like WebUI.scrollToPosition(0, 0) scrolls to the top of page as well.

So, why use the following then?

//Scroll to top of page

WebUI.delay(3)
WebUI.executeJavaScript('window.scrollTo(0, 0);', null)

Because I chose to use JavaScript with this example, you don’t have to use JavaScript if you don’t wish to. :sunglasses: