For each element loop UIElement is no longer valid

I currently have a for each loop that cycles through each item from the childrens of a find children activity.
The website consists of a scrollable list, each is a page that directs to a new page where you have to click “publish”, then it sends you back to the original website.
I used a “write line” activity to check the item.Get(“href”).ToString
However, once I clicked “publish” for the first item and returns back to the original website page, it shows UIElement is no longer valid

Pls help thank you

@bamboojoanne,

It’s because when your page redirects to the Publish page, your base page get’s outdated for the bot.

You should be getting all the UI elements URL into a datatable first and then do the navigation to each URL and click on publish. Use Table Extraction for this.

1 Like

Hi, I have to use the selectors because I don’t want to click all the pages, and the ones I need will be based on the “href” selector, can I still achieve this if I use table extraction and get the URLs?

@bamboojoanne,

I assume by ‘href’ mean the url of the UI Element. If there is any specific attribute on that basis you want to click, you can give it a try using table extraction.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.