Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix pagination classifier to prioritize semantic labels over shared glyph symbols
Laith Weinberger9ad4c63cdbd6
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.pyindex 44c205647..804cc451f 100644--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@ -1104,10 +1104,12 @@ class DomService:pagination_buttons: list[dict[str, str | int | bool]] = []# Common pagination patterns to look for+ # `«` and `»` are ambiguous across sites, so treat them only as prev/next+ # fallback symbols and let word-based first/last signals winnext_patterns = ['next', '>', '»', '→', 'siguiente', 'suivant', 'weiter', 'volgende']prev_patterns = ['prev', 'previous', '<', '«', '←', 'anterior', 'précédent', 'zurück', 'vorige']- first_patterns = ['first', '⇤', '«', 'primera', 'première', 'erste', 'eerste']- last_patterns = ['last', '⇥', '»', 'última', 'dernier', 'letzte', 'laatste']+ first_patterns = ['first', '⇤', 'primera', 'première', 'erste', 'eerste']+ last_patterns = ['last', '⇥', 'última', 'dernier', 'letzte', 'laatste']for index, node in selector_map.items():# Skip non-clickable elements@@ -1133,18 +1135,18 @@ class DomService:button_type: str | None = None+ # Match specific first/last semantics before generic prev/next fallbacks.+ if any(pattern in all_text for pattern in first_patterns):+ button_type = 'first'+ # Check for last button+ elif any(pattern in all_text for pattern in last_patterns):+ button_type = 'last'# Check for next button- if any(pattern in all_text for pattern in next_patterns):+ elif any(pattern in all_text for pattern in next_patterns):button_type = 'next'# Check for previous buttonelif any(pattern in all_text for pattern in prev_patterns):button_type = 'prev'- # Check for first button- elif any(pattern in all_text for pattern in first_patterns):- button_type = 'first'- # Check for last button- elif any(pattern in all_text for pattern in last_patterns):- button_type = 'last'# Check for numeric page buttons (single or double digit)elif text.isdigit() and len(text) <= 2 and role in ['button', 'link', '']:button_type = 'page_number'