Scroll to Element

  • Katalon Studio Version:
  • OS Version:
  • Browser Version:

Steps to Reproduce:

1.I am trying to scroll to am element on the same page that will not be in view.

I searched the forums and have can’t seem to get this working.
Here is my test script for your review. The two line are marked with **

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

WebUI.openBrowser(‘http://sc58lrdmd01:8090/mdm/bcm/framework/login.jsp’)

WebUI.navigateToUrl(‘http://sc58lrdmd01:8090/mdm/bcm/framework/login.jsp’)

WebUI.setText(findTestObject(‘Object Repository/Install Code/Page_Charter MDM Server/input_Charter MDM Server_username’),
‘KarlaAdmin’)

WebUI.setEncryptedText(findTestObject(‘Object Repository/Install Code/Page_Charter MDM Server/input_Login Name_password’),
‘WJh/YgfG6lrL/a8dqDFFEw==’)

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_Charter MDM Server/button_Log In’))

WebUI.maximizeWindow()

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/mat-card-content_SolutionsSolutions’))

WebUI.setText(findTestObject(‘Object Repository/Install Code/Page_MDM Server/input_Description_FILTER_DESCRIPTION’), ‘Install Code’)

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Search’))

WebUI.waitForElementVisible(findTestObject(‘Install Code/Page_MDM Server/label’), 30)

WebUI.waitForElementClickable(findTestObject(‘Install Code/Page_MDM Server/label’), 30)

WebUI.click(findTestObject(‘Install Code/Page_MDM Server/label’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_View Reference Data’))

WebUI.waitForElementVisible(findTestObject(‘Install Code/Page_MDM Server/label_1’), 30)

WebUI.waitForElementClickable(findTestObject(‘Install Code/Page_MDM Server/label_1’), 30)

WebUI.click(findTestObject(‘Install Code/Page_MDM Server/label_1’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Edit Enterprise Value’))

WebUI.scrollToElement(‘Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details’, 3)

WebUI.click(‘Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details’)

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/mat-icon_menu’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Approval Dashboard’))

WebUI.waitForElementVisible(findTestObject(‘Install Code/Page_MDM Server/label_1 (1)’), 30)

WebUI.waitForElementClickable(findTestObject(‘Install Code/Page_MDM Server/label_1 (1)’), 30)

WebUI.click(findTestObject(‘Install Code/Page_MDM Server/label_1 (1)’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Take Action’))

WebUI.waitForElementVisible(findTestObject(‘Install Code/Page_MDM Server/label_3’), 30)

WebUI.waitForElementClickable(findTestObject(‘Install Code/Page_MDM Server/label_3’), 30)

WebUI.click(findTestObject(‘Install Code/Page_MDM Server/label_3’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Accept’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/mat-icon_person’))

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/span_Logout’))

2.Error Test Cases/operations/Install Code FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.scrollToElement() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details, …]
Possible solutions: scrollToElement(com.kms.katalon.core.testobject.TestObject, int), scrollToElement(com.kms.katalon.core.testobject.TestObject, int, com.kms.katalon.core.model.FailureHandling)
at Install Code.run(Install Code:56)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1617310047739.run(TempTestCase1617310047739.groovy:25)
Thanks! Karla Fliger.

Expected behavior:
The button is clicked

Screenshots:
The button isn’t clicked. See Test and Error.

You have this:

You have got the following messages, which tells all you should care:

Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.scrollToElement() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details, …]

Solution: you should rather write:

WebUI.scrollToElement(findTestObject('Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details7), 3)

WebUI.click(findTestObject('Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details'))

Hello Thank you for your reply. I changed the scroll to element to
WebUI.scrollToElement(findTestObject('Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details), 3)

WebUI.click(findTestObject(‘Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details’))
and verified there were no errors. I ran the test case and am now getting this error:

Unable to click on object ‘Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Install Code/Page_MDM Server/a_Save Enterprise Details’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:75)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:619)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Install Code.run(Install Code:58)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1617365232293.run(TempTestCase1617365232293.groovy:25)
Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point (1281, 135). Other element would receive the click:


(Session info: chrome=89.0.4389.90)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘CORVSEGAL140Z19’, ip: ‘10.150.134.157’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 89.0.4389.90, chrome: {chromedriverVersion: 89.0.4389.23 (61b08ee2c5002…, userDataDir: C:\Users\P2970862\AppData\L…}, goog:chromeOptions: {debuggerAddress: localhost:65256}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 48c92eb8be48708ad37dcb53ccb2ee44
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.lambda$new$0(EventFiringWebDriver.java:404)
at com.sun.proxy.$Proxy12.click(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:417)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:68)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:75)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:619)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Script1617220949550.run(Script1617220949550.groovy:58)
… 11 more
Thank you in advance for your assistance!

Karla

This usually means something is in the way - the element you want to click is hidden by another element. Sometimes all you need to do is wait a short time for the target to be revealed. However…

Because you’re struggling with scroll issues, there is a chance the element has not been scrolled into view. Can you SEE the element when it fails?

Did you try WebUI.enhancedClick()?

Hello, I will try Webui.enhancedClick() and see if this works.

Thank you! WebUI.enhancedClick() worked! Have a nice day!