Simplify retry logic for ui helper functions
Improve code clarity and error messages for css selection