# The UiElement is no longer valid

> A UI Automation activity (for example, **Click**, **Type Into**, etc.) fails
with the following error message: `The UiElement is no longer
valid`.

## Description

A UI Automation activity (for example, **Click**, **Type Into**, etc.) fails
with the following error message: `The UiElement is no longer
valid`.

## Cause

The possible causes of the issue are the following:

* The issue could occur in web
  automation processes when the web page is reloaded after the selector search
  found the UI element, but the action on that element is yet to be
  executed.
  This may happen when looking for a web element that is no longer
  in the tab or in the frame, either because it was refreshed and invalidated,
  or because something on the page changed, and the selector no longer
  matches.
  The page might refresh automatically, even without any
  explicit instruction to refresh the screen.
* The issue could occur when the UI
  element is stored in a variable using the **Check App State** activity, for
  example, and the element is later used in another activity, following a
  refresh.
* The issue could occur if a
  located element is stored in the cache, but if the page changes in the meantime,
  this could make the reference invalid.

## Solution

To avoid this issue, you can do the following:

* Include the specific UI Automation
  activity in a **Retry Scope** activity.
* Check the readiness of the UI Element prior to the action, using the **Check
  App State** activity (or classic activities **Find Element** or
  **Element Exists**).
* Indicate the UI element again
  after the refresh, if an automatic page refresh occurs.
* Increase the **Delay after**/**Delay before** properties values or set the
  **Timeout** seconds value.
