@ -33,19 +33,22 @@ class AAOInfoAdapter(ManifestDrivenAdapter):
except Exception :
except Exception :
current_first_url = None
current_first_url = None
# Try clicking the specific page number button
# Determine which selector to use for the next page button
next_btn = page . query_selector ( f " #page-item- { next_page } a " )
primary_sel = f " #page-item- { next_page } a "
if not next_btn :
fallback_sel = " ul.pagination li.page-item:not(.active):not(.disabled):last-child a "
next_btn = page . query_selector (
" ul.pagination li.page-item:not(.active):not(.disabled):last-child a "
)
if not next_btn :
if page . query_selector ( primary_sel ) :
btn_sel = primary_sel
elif page . query_selector ( fallback_sel ) :
btn_sel = fallback_sel
else :
logger . debug ( f " [aaoinfo] No next page button found — stopping at page { page_index + 1 } " )
logger . debug ( f " [aaoinfo] No next page button found — stopping at page { page_index + 1 } " )
return False
return False
logger . debug ( f " [aaoinfo] Paginating to page { next_page } " )
logger . debug ( f " [aaoinfo] Paginating to page { next_page } " )
next_btn . click ( )
# Use page.click() (locator-based) so Playwright re-queries the element
# at click time, avoiding "not attached to DOM" errors after AJAX refresh.
page . click ( btn_sel )
# Wait for page indicator to become active
# Wait for page indicator to become active
try :
try :