--- id: "8d36c44d-9eef-447f-8fc3-a13f91aec01f" name: "Search-Based Email Finding" micro_summary: "Finds Gmail messages through search URLs when DOM row discovery fails, then waits for results before opening a matching thread." status: "resolved" see_also: [] scope: "How to find specific emails using Gmail's search URL instead of DOM scanning. goto_url with #search/ hash works reliably when DOM-based row finding fails." --- ## How It Works When DOM-based row finding fails (h4 elements missing, selectors changing), use Gmail's search URL to find specific emails: ```python goto_url('https://mail.google.com/mail/u/0/#search/from%3A%22Henry%20Sakhel%22') wait_for_load() wait(3) # extra wait for search results to render text = extract_text() # Search results show matching threads — click td[role] rows as normal ``` ## URL Patterns - `from:"Sender"` → `#search/from%3A%22Sender%22` - `subject:"Keyword"` → `#search/subject%3A%22Keyword%22` - Combined → `%20` between terms ## Key Detail After search navigation, wait 3 seconds for results to render. Gmail search is a client-side filter that takes time to execute. Then use the same `td[role]` clicking pattern as thread opening.