Cannot find elements when the selector is null - error in Katalon

Hello,
i have the Test object in my OR and i also see that appropriate object is getting highlighted with the defined Xpath.But when i execute my script i am getting “Cannot find elements when the selector is null” error in console.

WebUI.waitForElementPresent(findTestObject(‘TO’),5)

reporting_year = WebUI.getText(findTestObject(‘TO’))

can someone please help me on any workaround please.

Note:i am using Katalon Version 8.2.5

We need to see your actual REAL code. I’m assuming 'TO' is just a placeholder?

Also, follow this guidance:

Yes it was a TestObject :slight_smile:
WebUI.waitForElementPresent(findTestObject(‘Object Repository/Census Information/Year’),5)

reporting_year = WebUI.getText(findTestObject(‘Object Repository/Census Information/Year’))

Highlighted Xpath is provided for the test object Year.I am trying to get the value of Year and print it to assert it with expected value

If you run this code in the browser console, what does it say?

document.querySelector("span lightning-formatted-text[data-output-element-id=output-field]").innerText

Please paste a screenshot of the result.

Please find the required screenshot

Is the HTML in an iframe?

Is the HTML in a shadow DOM?

nope…i checked…no iframe or shadow tags in HTML

The xpath i have written is highlighting the current object but the test object with the same Xpath throws null object error…

Are you certain the xpath in the TO is correct?

What does this say?

document.querySelectorAll("lightning-formatted-text").length

yeah

That’s a crazy result. Did you run that code when the page was in the browser? Because that is nuts.

yes…i ran in the correct page

Can you show me more of the HTML? From the very top down to the YEAR element you’re trying to locate…

What does this return?

document.querySelectorAll("div").length




Did you forget the top?


its the beginning

What does this produce?

document.querySelectorAll("span slot").length

I’m stumped. I’m finding it hard to believe there’s no iframe on that page. But the length of 0 for span slot is evidently not true going by your screenshots.

:frowning: i am also trying hard to identify the root cause but failed to do it.Thats why reached this forum.
I am surprised with this behavior :frowning:

I don’t suppose the page is public?