I am getting ‘StaleElementReferenceException’, only if I execute the Testcase from Chrome Headless Browser.
if the same script executes from the chrome browser then it is running properly without any error.
also set screen resolution into chrome headless properties.
Below is the code.
WebUI.waitForElementClickable(findTestObject(‘Page_Sign in to your account/input_Sign in_idSIButton9 (1)’), 45)
WebUI.click(findTestObject(‘Page_Sign in to your account/input_Sign in_idSIButton9 (1)’))
That’s a completely different error with very different causes. What you’ve almost proved is, Chrome/Firefox headless behave differently.
This concerns me…
Stale elements (which I wish were called Stale Test Objects) are generally caused by page updates (not actual page refreshes). Please don’t confuse the two - you’ll confuse us in the process.
Your page, like it or not, is changing during the test case. You need to deal with it. Where in the test life-cycle that is happening is a question for you. Share more of your test code, mark out WHERE the error occurs and we’ll see if we can help pin it down.
Hi @Russ_Thomas, Could you please let me know the cause too. I am also facing the same issue.
When i execute my test cases on headfull browser, all test cases pass without any error but when executed on headless browsers, i stumble upon stale element exceptions.
And surprisingly this is very random (not on the same object always) and i am unable to find a generalized solution for it.
I understand that in the background my application page is updated and this is the cause for it to fail, but the same should be the scenario for headful browsers too. right? and do we have a generic solution for this kind of occurrences?
There is a danger that midway through trying to help you, you might say, “Oh, sorry, my error is slightly different…” or something equally time-wasteful.
So, please start a new topic and make sure you show me your errors exactly.