Unable to "Click' on web element

Hello,

i am unable to click on web element ‘Select’ as shown in the attached screenshot and error that is coming is also attached. If anybody can help?!
Xpath that i am using is: //button[@id=‘btnSelectCandidate’ and text()=‘Select’]

error is: Unable to click on object ‘Object Repository/Objects_007/Select Button’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Objects_007/Select Button’
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:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:604)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$8.call(Unknown Source)
at TC_007.run(TC_007:74)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
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 TempTestCase1562340591779.run(TempTestCase1562340591779.groovy:21)
Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point (620, 531)
(Session info: chrome=75.0.3770.100)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘COB10L-PF0V6548’, ip: ‘172.30.89.176’, 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 74.0.3729.6 (255758eccf3d24…, userDataDir: C:\Users\RBoparai\AppData\L…}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:49732}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 75.0.3770.100, webStorageEnabled: true}
Session ID: 128065148627dba8d8df4cce71b07e39
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
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:20)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
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:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:604)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$8.call(Unknown Source)
at Script1562334008624.run(Script1562334008624.groovy:74)
… 11 more

So this is the reason for the error, the element is not clickable. Could be that the element is not ready to be clicked, maybe try adding a waitForElement… step before your click step.

Or you could JS to perform the click

WebElement element = WebUiCommonHelper.findWebElement(findTestObject('your/object'),30)
WebUI.executeJavaScript("arguments[0].click", Arrays.asList(element))

@hpulsford i tried adding wait and with javascript, nothing is working.
It clicked 52 Wellington st w but it is not clicking select button
Here is my code:

WebUI.click(findTestObject(‘Objects_007/Page_SR 10308 Traffic - Sign 2 wellington st w - Cityworks/span_52 WELLINGTON ST W’))

WebUI.waitForElementVisible(findTestObject(‘Object Repository/Objects_007/Select Button’), 10, FailureHandling.STOP_ON_FAILURE)

WebUI.executeJavaScript(‘arguments[0].click’, Arrays.asList(findTestObject(‘Object Repository/Objects_007/Select Button’)))

not_run: WebUI.click(findTestObject(‘Object Repository/Objects_007/Select Button’), FailureHandling.STOP_ON_FAILURE)

This usually means the element is obscured by something else “getting in the way”.

Try this in the browser console:

document.querySelector("#btnSelectCandidate").click()

That should prove the button is clickable, but only when it is ready and visible on the screen.

The following error is coming now:
Test Cases/TC_007 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: document for class: Script1562334008624
at TC_007.run(TC_007:74)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
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 TempTestCase1562348043983.run(TempTestCase1562348043983.groovy:21)

Code that i have written is
WebUI.click(findTestObject(‘Objects_007/Page_SR 10308 Traffic - Sign 2 wellington st w - Cityworks/span_52 WELLINGTON ST W’))

WebUI.waitForElementVisible(findTestObject(‘Object Repository/Objects_007/Select Button’), 10, FailureHandling.STOP_ON_FAILURE)

document.querySelector(’#btnSelectCandidate’).click()

not_run: WebUI.executeJavaScript(‘arguments[0].click’, Arrays.asList(findTestObject(‘Object Repository/Objects_007/Select Button’)))

WebUI.click(findTestObject(‘Object Repository/Objects_007/Select Button’), FailureHandling.STOP_ON_FAILURE)

@hpulsford and @Russ_Thomas if you can suggest something please

I did. I’m waiting for your response.

@Russ_Thomas
I tried your suggestion as:-
The following error is coming now:
Test Cases/TC_007 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: document for class: Script1562334008624
at TC_007.run(TC_007:74)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
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 TempTestCase1562348043983.run(TempTestCase1562348043983.groovy:21)

Code that i have written is
WebUI.click(findTestObject(‘Objects_007/Page_SR 10308 Traffic - Sign 2 wellington st w - Cityworks/span_52 WELLINGTON ST W’))

WebUI.waitForElementVisible(findTestObject(‘Object Repository/Objects_007/Select Button’), 10, FailureHandling.STOP_ON_FAILURE)

document.querySelector(’#btnSelectCandidate’).click()

not_run: WebUI.executeJavaScript(‘arguments[0].click’, Arrays.asList(findTestObject(‘Object Repository/Objects_007/Select Button’)))

WebUI.click(findTestObject(‘Object Repository/Objects_007/Select Button’), FailureHandling.STOP_ON_FAILURE)
[/quote]

Please follow my instructions (which do not involve Katalon in any way).

@Russ_Thomas
when i tried the following in browser console
document.querySelector("#btnSelectCandidate").click()
It says undefined
And that pop up window immediately disappears as soon as i click enter for running this query in browser console.

Perfect.

Which proves your selector for the Select Candidate button can be used to click the button.

Now, in your test script, try this:

WebUI.waitForElementVisible(findTestObject("Object Repository/Objects_007/Select Button"), 10)
String js = "document.querySelector('#btnSelectCandidate').click()"
WebUI.executeJavaScript(js, null)

This assumes #btnSelectCandidate is the ID contained in Objects_007/Select Button. The script will wait for the button to become visible, then try to click it.

1 Like

@Russ_Thomas
Yeah! It worked.

Thank You So much

1 Like