For each UIElement is not working

Re capture and compare , there might be some value in selectors which will be dynamic. Compare the selectors.