The element does not exist in DOM anymore

Hi,

Appium throws intermittent error

selenium.common.exceptions.StaleElementReferenceException: Message: The element 'By.id: com.androidsample.generalstore:id/productPrice' does not exist in DOM anymore

Code:
driver.find_element_by_id("com.androidsample.generalstore:id/productPrice").is_displayed()

Test data:
Appium Version: 1.17.1
Python Version: 3.8
IDE: Pycharm

Kindly guide me to resolve above issue.

Best Regards,
Gaurav Valera

Issue is fixed after applying Explicit Wait.In case some one is facing the same issue, do apply following steps:

            wait = WebDriverWait(self.driver, 8)
            wait.until(expected_conditions.presence_of_element_located((By.ID, "productPrice")))
            self.driver.find_element_by_id("productPrice").is_displayed()

Note: Import necessary packages too :slight_smile:

Which packages require to handle this exception?
@Gaurav_Valera