#!/usr/bin/env python3 """Quick debug to see what's happening""" import yaml import time from seleniumbase import Driver from selenium.webdriver.common.by import By def load_config(): with open('config.yaml', 'r') as f: return yaml.safe_load(f) config = load_config() url = config.get('url') driver = Driver(uc=True, headless=False, page_load_strategy="normal") try: print(f"Loading: {url[:100]}") driver.get(url) time.sleep(3) print(f"Title: {driver.title}") print(f"URL: {driver.current_url[:100]}") time.sleep(2) # Handle GDPR consent page if 'consent.google.com' in driver.current_url: print("On consent page, looking for accept button...") try: # Look for various consent buttons consent_selectors = [ 'button:has-text("Accept all")', 'button:has-text("Aceptar todo")', 'button[aria-label*="Accept"]', 'button[aria-label*="Aceptar"]', 'form button[type="submit"]', '//button[contains(., "Accept")]', '//button[contains(., "Aceptar")]', ] for selector in consent_selectors: try: if selector.startswith('//'): btns = driver.find_elements(By.XPATH, selector) else: btns = driver.find_elements(By.CSS_SELECTOR, selector) print(f" Selector '{selector[:30]}...': found {len(btns)} buttons") if btns: print(f" Clicking: {btns[0].text[:50]}") btns[0].click() time.sleep(2) break except: continue print(f"After consent click: {driver.current_url[:100]}") time.sleep(3) except Exception as e: print(f"Consent error: {e}") # Now try cookie banner on Maps page try: cookie_btns = driver.find_elements(By.CSS_SELECTOR, 'button[aria-label*="Accept" i]') print(f"Found {len(cookie_btns)} cookie buttons") if cookie_btns: cookie_btns[0].click() time.sleep(1) except Exception as e: print(f"Cookie error: {e}") # Click reviews tabs = driver.find_elements(By.CSS_SELECTOR, '.LRkQ2, button[role="tab"]') print(f"Found {len(tabs)} tabs") for tab in tabs: text = (tab.text or '').lower() if 'review' in text: print(f"Clicking: {tab.text}") driver.execute_script("arguments[0].click();", tab) break time.sleep(3) # Check reviews reviews = driver.find_elements(By.CSS_SELECTOR, 'div.jftiEf.fontBodyMedium') print(f"Found {len(reviews)} review elements") # Check pane panes = driver.find_elements(By.CSS_SELECTOR, 'div[role="main"] div.m6QErb') print(f"Found {len(panes)} pane elements") time.sleep(10) # Keep browser open finally: driver.quit()