I want to create a macro that detects whether anything in a certain element of a certain web page changes, and if so, takes a screenshot of the element and saves the contents of the element to CSV (text and hyperlinks).
For the time being, I have a crude start to this, which simply detects whether the element is present based on its ID. So for now, whenever the element is present, it just takes a screenshot of the element, exports it with a timestamp, and saves the element’s visible text, the element’s source code, and the timestamp to CSV.
The trouble with that is the element can change at any time, but letting the macro run for several hours or a whole day to capture as many changes as possible results in a lot of redundant screenshots and CSV lines since it’s currently just detecting whether the element is there, and if so, saving a new screenshot and CSV line.
So I’m wondering if there’s some way to not simply detect whether the element is there, but also whether any of its contents have changed since the last time it was loaded, and only export a new screenshot and add to the CSV if it has changed. (That is, I only want to detect changes within that particular element–not the rest of the page outside of the element.)
Here’s a recap of the logic:
- Open web page
- Is “SomeStuff” element present?
- If no, start over. If yes, has “SomeStuff” element changed since last run?
- If no, start over. If yes, save text/URLs within “SomeStuff” element to CSV, and export a screenshot of “SomeStuff” element, then start over.
It’s that third bullet about detecting a change that I would like to address now–can that be done with UI.Vision RPA, and if so, how?