Stale element not found, is this relate to using same Object?

I decided to make another copy of my test cases, it yields same error when repeated same object name #7 and #9.

Here are my test step.
  1. Open browser,

  2. Click select 'log in with Microsoft Azure,

  1. Input user account then click ‘Next’

2023-09-29_13-16-36

  1. Input user credential and then click ‘Next’ (error shown in this step).

2023-09-29_13-18-42

The 'Next' button in hold similar Object Name and locators. Object Repository for input_Sign in _idSLButton9 derived from Record Web tool.

my apologies to you if my reply hurts in any manner

2 Likes

Can you at least use the Inspect in browser and show us the html code, in both cases?
If there is some sensitive data, you can censor it but keep the html structure intact.

See this topic for guidance on how to use Developer Tools:

1 Like

And since you seem to be moving from one page to another, you should insert a “wait” statement to allow the pages to form. An example would be:

"input 'User Account to sign in"
WebUI.setText(findTestObject('input_Sign in_loginfmt'), "...")

"click 'Next' button from sign-in page"
WebUI.click(findTestObject('input_Sign in_idSIButton9'))

WebUI.waitForPageLoad(10)    //<===

"input user's credential"
WebUI.setEncryptedText(findTestObject('input_Enter password_passwd'), '...')

"click 'Next' btn, move to Stay signed in?"
WebUI.click(findTestObject('input_Sign in_idSIButton9'))

WebUI.waitForPageLoad(10)    //<===
2 Likes

@grylion54 thanks a lot for your advice, I did add Wait for Element Visible / Present prior screensharing to team here. And adding more wait time from “5” to “10”. But it mean nothing, I still got same error message after running it.

@bionel

As request, here were screenshot with HTML code.
#1 main log in page

#2 log in page → input user account

#3 credential page → input user password

After skim through the code, it seems most part of them are similar. Then have no clue where to move. Please help and advice. thank you all :slight_smile:

We need to read the full source codes of your HTML, javascript and CSS. Especially the javascripts matters. Screenshots are not enough for investigation.

Please save the page into a single file (MIME HTML) using Chrome as the following post tells.

We want 2 files each contains the full source of

this

and this

You can attache the saved files here in the forum thread.

For more information…

I knew that it’s not good manner to compare 2 tools but just to share that my previous code for same log in page was successfully executed, with repeated object id - “idSIButton9”.

3 buttons which hold similar ID “idSIButton9”, in my testing…

ok, i’ll copy & paste soon. thanks for your always support @kazurayam

It is a very GOOD idea to compare the 2 tools. You used the Selenium IDE. You were successful with it. You also tried Katalon Studio. You were NOT successfull with KS. This implies that there could be some bug in Katalon Studio.

<<I noted this later. Your script in Selenium IDE is not identical to the script you used in Katalon Studio. In Selenium IDE, you are calling “wait for element visible” repeatedly = 3 times. In Katalon Studio, you are calling “WebUI.waitForElementVisible()” keyword only once. You are executing quite diffent tests! So the results could be different. The comparison proves nothing meaningful.>>

I have checked the source code of Katalon’s WebUI.click keyword but I could not find any quick answer to the “stale element reference” problem. I still have no idea. I am afraid, it would require insensive debugging to find a bug in Katalon Studio. I want some Katalon Staff to look into this

@vu.tran
@Elly_Tran

What @bharathi.a suggested could be a practical workaround the problem for you, @jirayu.s. You can use either CSS Selector or XPath interchangeably to express the locator to the button. :slight_smile:

2 Likes

Hi all,

Thank you so much for a great discussion. Hope that all of us can learn a lot from this discussion. In the meantime, I will note this case down and collect other cases for us to investigate the issue. @jirayu.s Hope you have found the workaround for your case. If not, feel free to raise another thread so that we can focus on your problem much better.

Thank you all! Have a good day :confetti_ball:

4 Likes

@Elly_Tran noted with thanks, it seems that I can’t find any further solution due to it utilize same locator. I’ll open another thread that need support from Katalon team.

Much appreciate for your help and guidance. :slight_smile:

@jirayu.s

Are you going to provide the MIME HTML files to us?
Katalon team would require it to look into their product.

@kazurayam My web application was developed with low code platform solution, sorry no name mentioned here. And my Engineer said that most part of our code store under JavaScript which internally stored at our server then you can’t trace it back. My Engineer show such code, they’re encrypted also.

@jirayu.s

Are you a paying user? If so, you are qualified to raise an official support request to Katalon. You should do it. It would make their internal communication in the team easier. The official request will ensure your issue to be addressed by the development team. A debates in the user forum might not be enough to let them work for you.

I’m free-tier user, then no qualified to open support ticket.

@Elly_Tran

Would you follow this up?

For your information.

I’m just have a chat with my vendor (low-code platform vendor), he said that log in screens were Microsoft Azure authentication page, not his part.

For ref, here’s the script I use for the exact same login - mine doesn’t start with ‘log in via Microsoft Azure’ button click but your screenshots after that step look the same. I haven’t got around to checking whether a hardcoded delay of 5 seconds is vital but feel free to try it out:

WebUI.setText(findTestObject('Login/Login_OR/input_loginfmt'), GlobalVariable.UserID)

WebUI.delay(5)

WebUI.click(findTestObject('Login/Login_OR/input_idSIButton9'))

WebUI.waitForPageLoad(10, FailureHandling.STOP_ON_FAILURE)

WebUI.setEncryptedText(findTestObject('Login/Login_OR/input_Enter password_passwd'), GlobalVariable.User_Password)

WebUI.click(findTestObject('Login/Login_OR/input_idSIButton9'))

WebUI.click(findTestObject('Login/Login_OR/input_StaySignedNo'))

WebUI.waitForPageLoad(10)
2 Likes

Hi DAN, based on your script, it seems that the above two lines were different from mine. And for 'Log in via Microsoft Azure, it was redirect from our low code main page. But after click Log in vi Microsoft Azure, we’re on the same log in page. But why your line differ from mine. T__T