seleniumappiumpython-appiumstaleelementreferenceexception

(Appium-Python) Difference of "Element could not be located on the page using the given search parameters" & "Element does not exist in DOM anymore"


As above. Encountered these two issues.

An element could not be located on the page using the given search parameters.

The element does not exist in DOM anymore


Solution

  • The first error

    An element could not be located on the page using the given search parameters

    Indicates that Selenium could not find element matching the given locator on the page.
    While the second error

    The element does not exist in DOM anymore

    Indicates that the element was on the page, but no more existing there.
    This is actually a Selenium Stale Element error.
    Stale means old, decayed, no longer fresh. Stale Element means an old element or no longer available element. Assume there is an element that is found on a web page referenced as a WebElement in WebDriver. If the DOM changes then the WebElement goes stale. If we try to interact with an element which is staled then the StaleElementReferenceException is thrown.