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:
[Updated August 2020]
My test is BROKEN! NOTHING WORKS! HELP ME!
Relax. We get it. We really do. There are some pretty smart and clever people on this forum, but you must realize, they are not magicians or wizards or gods. They cannot see your code, they can’t see your errors and they don’t even know what your AUT is meant to do even though it might seem perfectly obvious to you.
So please relax and follow the advice below, before you start writing your post. The advice below will tell you…
Yes it was a TestObject
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
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
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.
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
I don’t suppose the page is public?