Advice on Katalon failure on valid Locator

Hi Experts
Due advanced apologies, I am just starting and moved to Katalon recently, so be kind to me and guide me.
I have a refined Xpath locator, tested as working using Chropath, Chrome Developer Console as show in picture.
It is a simple locator //a[@title=‘Leads’]
the HTML code is attached. I have 2 questions

  1. Help to understand why my locator is failing and guide me to materials so that I can be success
  2. My script with test steps which is passing in Chrome is failing in Firefox, is there a settings i must do in Katalon. Yes there are other scripts where firefox is ok, bit weird but I think I must have not configured Katalon right

Hi and welcome.

I’d like to see the entire error message. Please post it.

Is the target inside an iframe?

Is the element you’re waiting for in Step 1 the same element you’re trying to click in Step 2?

There are no special steps you need to execute in Firefox compared to Chrome (ignoring any desired capabilities you may use).

Thank you Russ,

I have posted you an error message, Is that you expect to see, to help me.

Is the target inside an iframe?
No it is the main application.

Is the element you’re waiting for in Step 1 the same element you’re trying to click in Step 2?
Yes I have added as part of my debugging and to ensure an element is visible

Question: Is there way, to know as I don’t have access to developers, if the WebApplication is Frames or iFrames?
Thanks in advance and appreciate your help

@newbie

Unfortunately your image cuts short as the most important part: root cause. Please copy and paste the entire log in here, you can wrap the portion with triple quotes in the Forum’s text editor to clearly indicate it’s a code/log.

Apologies, my mistake.
Here is the extract and below is the reference I found on net, Please need your valuable guidance on how to deal in this kind of situations. This is Salesforce stuff

Blockquote “”"
Unable to click on object ‘Object Repository/ClickNewLead/ClickLead’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/ClickNewLead/ClickLead’

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:76)

at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)

at NavigatetoLead.run(NavigatetoLead: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: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.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:59)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)

at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.execute(CallTestCaseKeyword.groovy:44)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)

at com.kms.katalon.core.keyword.BuiltinKeywords.callTestCase(BuiltinKeywords.groovy:334)

at TC_ClickNewLead.run(TC_ClickNewLead: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: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 TempTestCase1593561723404.run(TempTestCase1593561723404.groovy:25)

Caused by: org.openqa.selenium.JavascriptException: javascript error: Cannot read property ‘defaultView’ of undefined

(Session info: chrome=83.0.4103.116)

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’

System info: host: ‘KRM1968’, ip: ‘192.172.12.72’, 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: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b…, userDataDir: C:\Users\Kpaul~1.Dill\AppDat…}, goog:chromeOptions: {debuggerAddress: localhost:49803}, 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:virtualAuthenticators: true}

Session ID: 037f1f15cd68a76779f92b4238a20798

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.$Proxy14.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:69)

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:76)

at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)

at Script1593356923911.run(Script1593356923911.groovy: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: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.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:59)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)

at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)

at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.execute(CallTestCaseKeyword.groovy:44)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)

at com.kms.katalon.core.keyword.BuiltinKeywords.callTestCase(BuiltinKeywords.groovy:334)

at Script1593433532822.run(Script1593433532822.groovy:21)

… 11 more

) “”"
Blockquote

Is my issue same as here https://softwaretestingboard.com/q2a/3377/getting-javascript-cannot-property-defaultview-undefined#axzz6QywqH6Hn

this is caused bcz of object not identified with the given object identification method. I also get the same issue when I try to automate the sales force. this is one of the tab (Accounts) that I need to click in slaesforce and I used in previously for identify the object below xpath . somehow it does not work and later I have updated the xpath. after that it worked fine.

Accounts

previous Xpath : .//a[@title=‘Accounts’]/span

updated Xpath: By.xpath(".//one-app-nav-bar-item-root[@class=‘navItem slds-context-bar__item slds-shrink-none’][a[span[text()=‘Accounts’]]]")

Read more: https://softwaretestingboard.com/q2a/3377/getting-javascript-cannot-property-defaultview-undefined#ixzz6Qz1ngXb8

Please advise, how to find xpath in these kind of situations as this is just a first page after login

  1. Open the web page in your browser.

  2. Open the browser DevTools.

  3. In the console tab, type this:

document.querySelectorAll("one-app-nav-bar a[title=Leads] > span").length

If it returns 1, then change your Test Object ClickLead to use CSS and provide it with this selector:

one-app-nav-bar a[title=Leads] > span

Let me know what happens.

Thank you Russ
Console returned 0.

Please advise. Note: It is clickable element also is a dropdown element, I am not sure, if this helps

Follow these steps to define the default behavior for failure handling to be applied across your project:

From Katalon Studio menu, access Project > Settings > Test Design > Test Case.

Select the preferred option for the default behavior of Failure Handling. Click OK when you’re done.

The selected option will be applied to new test steps only. For the steps already existed in your test cases, their failure handling option will not be affected by this change. Thus, you may need to update them manually.

Override failure handling behavior
You can override the default failure handling behavior for each test step manually in either Manual view or Scripting view of test case.

Are you sure you were viewing the correct page in the browser?

Hi Russ
I assure you that, first I typed xpath to confirm “Leads” is Highlighted and then typed you console command returned zero.

Hi Lewis
Thank you, Being new to Katalon and with only few hours of Java / selenium experience, I will do my best to follow your steps and try my luck. Is Semi Automation possible in Katalon, i,e if I click on something Manually while automation is in progress can Katalon still move on to next step?

@newbie

Yes, you can. Your manual action would change the state of the AUT without Katalon’s awareness, so you may want to be careful.

Thank you Thanh, Russ and Lewis

When I change from webUI.click to WebUI.enhancedClick it worked.
Is there a guide which has all the commands and explanations, when to use etc That will really help me