Error while clicking on an object

All,
I am getting the following error when clicking on an object. I would appreciate if you could assist me.

  1. https://missionbio.com/
  2. From the top navigation, I clicked on Capabilities>>SNV and got an error.

Error:
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object

Here is the test script:

WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘https://missionbio.com/’)
WebUI.waitForElementClickable(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’), 40)
WebUI.click(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’))
WebUI.closeBrowser()

In the error message, is there a “Caused by…” section?

It’s always better if you post the complete error message.

Here is the complete error message;

============== ROOT CAUSE =====================
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable
At object: ‘Object Repository/New Folder/a_SNV’

Try…

WebUI.enhancedClick(findTestObject('Page_Single Cell Technology Mission Bio/a_SNV'))

This time I got this error:
Caused by: java.lang.IllegalArgumentException: Object is null

Here is my script:
WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘https://missionbio.com/’)
WebUI.enhancedClick(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’))
WebUI.closeBrowser()

I’m not surprised. You changed the original test:

WebUI.waitForElementClickable(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’), 40)

I am still getting the error.

WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘https://missionbio.com/’)
WebUI.waitForElementClickable(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’), 40)
WebUI.enhancedClick(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’))
WebUI.closeBrowser()

Error:
=============== ROOT CAUSE =====================
Caused by: java.lang.IllegalArgumentException: Object is null

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshoot-common-execution-exceptions-web-test.html

02-09-2021 11:08:16 AM Test Cases/TC002-SNV

Elapsed time: 9.796s

Test Cases/TC002-SNV FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to wait for object to be clickable
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.internal.WebUIKeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.webui.keyword.builtin.WaitForElementClickableKeyword.waitForElementClickable(WaitForElementClickableKeyword.groovy:107)
at com.kms.katalon.core.webui.keyword.builtin.WaitForElementClickableKeyword.execute(WaitForElementClickableKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementClickable(WebUiBuiltInKeywords.groovy:501)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$waitForElementClickable$1.call(Unknown Source)
at TC002-SNV.run(TC002-SNV:21)
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:339)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)
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 TempTestCase1612890494753.run(TempTestCase1612890494753.groovy:25)
Caused by: java.lang.IllegalArgumentException: Object is null
at com.kms.katalon.core.helper.KeywordHelper.checkTestObjectParameter(KeywordHelper.java:33)
at com.kms.katalon.core.helper.KeywordHelper$checkTestObjectParameter.call(Unknown Source)
at com.kms.katalon.core.webui.keyword.builtin.WaitForElementClickableKeyword$_waitForElementClickable_closure1.doCall(WaitForElementClickableKeyword.groovy:75)
at com.kms.katalon.core.webui.keyword.builtin.WaitForElementClickableKeyword$_waitForElementClickable_closure1.doCall(WaitForElementClickableKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 18 more

They have an awkward set of CSS hovers and JS mods going on in that page/site. It’s also very easy to break it (try shrinking the page while the CAPABILITIES popup menu is visible - breaks easily).

So, let’s be pragmatic and go directly to JS instead:

WebUI.waitForElementClickable(findTestObject('Page_Single Cell Technology Mission Bio/a_SNV'), 40)
String js = 'document.querySelector("a[href$=\"/capabilities/snv/\"]").click();'
WebUI.executeJavaScript(js, null);

I hope I got the quoting right - it’s tricky.

This time I got this message: Caused by: java.lang.IllegalArgumentException: Object is null

I didn’t. I checked it on the same website.

Make sure the " and \" are correct - look at my original.

Can you please confirm if the script that I have written is correct as per your suggestion?

WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘https://missionbio.com/’)
WebUI.waitForElementClickable(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’), 40)
String js = ‘document.querySelector(“a[href$=”/capabilities/snv/"]").click();’
WebUI.executeJavaScript(js, null);
WebUI.click(findTestObject(‘Page_Single Cell Technology Mission Bio/a_SNV’))
WebUI.closeBrowser()

No, it isn’t correct. My last suggestion was to make sure you got the quotes correct - I said they were tricky. This is what you’re missing:

image

Alternatively, do this for the String js = part…

String js = '''
document.querySelector('a[href$="/capabilities/snv/"]').click();
'''
WebUI.executeJavaScript(js, null);

Make sure you lay it out exactly like it appears there. None of this is your fault, string parsing with embedded quotes is never as easy as it might look. And in Groovy (with GStrings) it gets even trickier. :confused:

Hopefully, that will get you going!

ah, this is probably the GString problem. Use that last alternative with triple single quotes.