Not able to scroll up and click on the button element

I am not able to scroll up the page to a specific element. I used all possible scripts but did not get any luck. Can you please help. Below are the script I am using to scroll up the page

  • WebUI.scrollToElement(findTestObject(‘Object Repository/Page_Purchase Order/button_Save’), 3)

  • WebUI.executeJavaScript(‘window.scroll({top: 0, left: 0});’, null)

  • WebUI.scrollToPosition(0, -250)

  • WebUI.executeJavaScript(‘window.scrollTo(0, -document.body.clientHeight)’, 0)

  • WebUI.executeJavaScript(‘window.scrollTo(0, -document.body.scrollHeight)’, save_button)

All the above-added scripts do not work a single time for me. Thanks in advance

The above is incorrect. It is scroll TO position, not scroll from position. For this one, try:

WebUI.scrollToPosition(100, 10)  // scroll to top of the page
WebUI.delay(1)

You don’t need the delay. I add it because it gives me time to see the new location.

1 Like

Thanks @grylion54 for the quick reply. Sorry to say but it also does not work for me

What system are you using? Perhaps the Katalon Team needs some info on their product with your configuration to investigate why the statement does not work. I use the two statements, scrollToPosition and scrollToElement, all the time and I haven’t had a concern.

		WebUI.delay(1)
        WebElement element = WebUiCommonHelper.findWebElement(findTestObject('Page_Purchase Order/button_Save'), 10)
		WebUI.scrollToPosition(100, element.getLocation().getY())
		WebUI.delay(1)