Well, this issue looks like it occurs randomly. Some times this “UiElement is no longer valid” error pops up in a specific place and when re-running the process again, magically doesn’t appear any more.
If it would be an issue with the selector, errors such as “Selector cannot be found” or “Selector not valid” would appear instead. However, this other error might be due to the fact that, actually UiPath finds the button that matches perfectly with the provided selector but when goes to click on it, right in that time, the page refreshes and, even if you end up having an Element that still matches your selector, you are still holding a reference to the “old” object, which doesn’t exist anymore in the page.
Not sure about how to solve this problem. Maybe retrying to click on it if this error appears.