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

**URL:** <https://forum.katalon.com/t/stale-element-not-found-is-this-relate-to-using-same-object/97973>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [September 29, 2023, 6:28am UTC](https://forum.katalon.com/t/stale-element-not-found-is-this-relate-to-using-same-object/97973 "2023-09-29T06:28:48Z")\
**Posts on this page:** 1\
**Showing post:** 107

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [October 12, 2023, 9:19pm UTC](https://forum.katalon.com/t/stale-element-not-found-is-this-relate-to-using-same-object/97973/107 "2023-10-12T21:19:56Z")

</div>

The following is a variation of my Test Case where I enable and disable the Smart Wait by code. I think that explicit code is better than by config.The code clearly reminds me that I need the Smart Wait here.

```auto
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable

/**
 * automate signing-in to Microsoft Azure DevOps with Smart Wait
 */

TestObject makeTestObject(String id, String xpathExpression) {
    TestObject tObj = new TestObject(id)
    tObj.addProperty("xpath", ConditionType.EQUALS, xpathExpression)
    return tObj
}

// enable Smart Wait explicitly
WebUI.enableSmartWait()

String url = "https://dev.azure.com/${GlobalVariable.ACCOUNT}"
WebUI.openBrowser(url)
WebUI.setViewPortSize(800, 800)

TestObject loginfmt = makeTestObject("loginfmt", "//input[@name='loginfmt']")
WebUI.sendKeys(loginfmt, GlobalVariable.EMAIL)

TestObject nextButton = makeTestObject("Next", "//input[@id='idSIButton9']")
WebUI.click(nextButton)

TestObject passwd = makeTestObject("Passwd", "//input[@name='passwd']")
WebUI.sendKeys(passwd, GlobalVariable.PASSWD)

TestObject signinButton = makeTestObject("SignIn", "//input[@id='idSIButton9']")
WebUI.click(signinButton)

TestObject yesButton = makeTestObject("Yes", "//input[@id='idSIButton9']")
WebUI.click(signinButton)

WebUI.closeBrowser()

WebUI.disableSmartWait()

```

I no longer need any calls to `WebUI.waitFor***` and `WebUI.delay` in the block enclosed by a pair of `enableSmartWait()` and `disableSmartWait()`.

Cuckoo!

---

_[View the full topic](https://forum.katalon.com/t/stale-element-not-found-is-this-relate-to-using-same-object/97973)._
