Need help in resolving the error

i am trying to cllick and enter text in the text area but my script always fails in identifying those objects.can some one help me please?

Full Xpath:

/html/body/div[4]/div[1]/section/div[1]/div[2]/div[2]/div[1]/div/div/div/div[3]/div/one-record-home-flexipage2/forcegenerated-adg-rollup_component___force-generated__flexipage_-record-page___-s-n-f_-census_-case_-record_-page___-s-n-f_-census_-case__c___-v-i-e-w/forcegenerated-flexipage_snf_census_case_record_page_snf_census_case__c__view_js/record_flexipage-record-page-decorator/div[1]/records-record-layout-event-broker/slot/slot/flexipage-record-home-template-desktop2/div/div[2]/div[1]/slot/flexipage-component2/slot/flexipage-tabset2/div/lightning-tabset/div/slot/slot/flexipage-tab2[2]/slot/flexipage-component2[4]/slot/flexipage-field-section2/div/div/div/laf-progressive-container/slot/div/slot/flexipage-column2[1]/div/slot/flexipage-field[1]/slot/record_flexipage-record-field/div/div/div[2]/button

I suppose you used Katalon Studio’s Recorder tool or Spy tool to get this XPath. This XPath expression is just terrible. It does not worth looking at.

You should stop using these tools.

You should rather study XPath or CSS Selector, and write an locator manually for yourself.

For XPath, see the following article

For CSS Selector, refer to this post

1 Like

Your error message says you have an id attribute that it is trying to use. Do you have more than tag and xpath checked to be used as “Detect by” or do you have the whole galaxy? Remove the check in the “Detect by” column except for the two I suggested and try again. (Actually, delete all others except for the two I suggested/)

@shri.lakshmi

Is your taget URL is open to the Internet, so that others can see on their own PC? If so, please share the URL here.

If you can not share the URL, I can not see the HTML. I can not know anything about it. So I will quit this discussion.

sorry.its not open to internet :frowning:

Since “path” is not the same as "//button[@title='Edit Reason for Change']", I think you are leaving a lot out. How about filling the puzzle in so we can follow what you are trying to do?

can i share u the screenshot of the HTML?

sure i can do that

Okay, so your xpath looks like it should work. Again, how does the error message say one thing and your xpath another? How are you using it? Do you have the xpath in an element within the Object Repository or are you trying to create an element dynamically or…?

i have this xpath for an element in object repository and included this:

WebUI.waitForElementClickable(findTestObject(‘object repository path’),
10)

WebUI.click(findTestObject(‘object repository path/button_Edit Reason for Change’))

And you say it is not working. How about trying the below?

WebUI.waitForElementClickable(findTestObject('mypath/button_Edit Reason for Change'), 10)

WebUI.enhancedClick(findTestObject('mypath/button_Edit Reason for Change'))

image
Highlighted is the intended object trying to click


Code i have used
WebUI.waitForElementClickable(findTestObject(‘Object Repository/CALARM-432/CALARM-934/Page_Additional information section/Edit_Button’),
10)

WebUI.enhancedClick(findTestObject)(findTestObject(‘Object Repository/CALARM-432/CALARM-934/Page_Additional information section/Edit_Button’))

Error i am getting:

7:28.822 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/CALARM-432/TC35_CALARM-1239_Scenario 2 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: findTestObject for class: Script1670550469953
at TC35_CALARM-1239_Scenario 2.run(TC35_CALARM-1239_Scenario 2:79)
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:442)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:202)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:164)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:105)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:185)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1670691374386.run(TempTestSuite1670691374386.groovy:36)

2022-12-10 08:57:28.830 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/CALARM-432/TC35_CALARM-1239_Scenario 2 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: findTestObject for class: Script1670550469953
at TC35_CALARM-1239_Scenario 2.run(TC35_CALARM-1239_Scenario 2:79)
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:442)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:202)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:164)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:105)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:185)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1670691374386.run(TempTestSuite1670691374386.groovy:36)

You have an error in your statement. Fix the error I have highlighted and try again.

ohh gosh…i missed to notice the type…thank you so much…it Worked but still the error displays :
2022-12-10 09:20:00.306 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //button[@title=‘Edit Reason for Change’] '. Please recheck the objects properties to make sure the desired element is located.
2022-12-10 09:20:00.307 WARN c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] Failed to find element with id ‘Object Repository/CALARM-432/CALARM-934/Page_Additional information section/Edit_Button’. Try using Self-healing.
2022-12-10 09:20:01.330 INFO c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] No working XPath is found.
2022-12-10 09:20:02.357 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: '. Please recheck the objects properties to make sure the desired element is located.
2022-12-10 09:20:02.365 WARN c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] Cannot find elements when the selector is null
2022-12-10 09:20:02.391 WARN k.c.w.k.b.WaitForElementClickableKeyword - Web element with id: ‘Object Repository/CALARM-432/CALARM-934/Page_Additional information section/Edit_Button’ located by '//button[@title=‘Edit Reason for Change’] ’ not found

Do you have an <iframe> tag above the HTML area you show us? If you do, you have to move to it as a step. You can see more about that on this forum if that is the case.

no iframe tag but starts with slot tag

The only other thing that I can come with at this time is to put in a long wait to see if the above statement is not enough. Perhaps:

WebUI.waitForElementClickable(findTestObject('mypath/button_Edit Reason for Change'), 10)

//WebUI.waitForElementVisible(findTestObject('mypath/button_Edit Reason for Change'), 10)

WebUI.delay(5)

If the above works, then you need to try other “wait” statements.

Thank you @grylion54 i have added login wait and it worked!Thank you

Using a hard-coded delay of the test case is a bandaid.

What is happening right before the click? What are we doing right before the click?