Skip to content

fix: StocktonOnTeesCouncil - update form IDs to V2, dismiss cookie banner, fix test fixture#1954

Open
InertiaUK wants to merge 4 commits intorobbrad:masterfrom
InertiaUK:fix/stockton-v2-form
Open

fix: StocktonOnTeesCouncil - update form IDs to V2, dismiss cookie banner, fix test fixture#1954
InertiaUK wants to merge 4 commits intorobbrad:masterfrom
InertiaUK:fix/stockton-v2-form

Conversation

@InertiaUK
Copy link
Copy Markdown

What this changes

Stockton's AchieveForms form name has been renamed from LOOKUPBINDATESBYADDRESSSKIPOUTOFREGION_* to LOOKUPBINDATESBYADDRESSSKIPOUTOFREGIONV2_*. Every element ID the scraper looks up needs the V2 suffix, so the postcode input is no longer found and the scraper times out on the first WebDriverWait.

Additionally, the cookie consent banner has started covering the search button on fresh sessions, and send_keys(ENTER) was silently intercepted by the overlay.

Changes

  • LOOKUPBINDATESBYADDRESSSKIPOUTOFREGION_ -> LOOKUPBINDATESBYADDRESSSKIPOUTOFREGIONV2_ across all element IDs (postcode input, search button, address dropdown, results panel).
  • Added a cookie-banner dismissal step right after driver.get — matches the pattern used in other AchieveForms councils.
  • Updated the test fixture in input.json:
    • postcode: TS20 2RD -> TS19 0RF
    • house_number: 24 -> 1 (1 Bishopton Avenue)
    • url: https://www.stockton.gov.uk -> https://www.stockton.gov.uk/bin-collection-days

The old fixture's TS20 2RD #24 returns no match in the current dropdown (probably due to an address refresh on Stockton's side), so the CI would still fail even with correct element IDs. TS19 0RF #1 is a real residential property in Norton that comes back with three active bins.

Test

Verified with the VPS UC wrapper:

{
  "bins": [
    { "type": "Garden waste bin", "collectionDate": "16/04/2026" },
    { "type": "Rubbish bin",      "collectionDate": "16/04/2026" },
    { "type": "Recycling bin",    "collectionDate": "16/04/2026" }
  ]
}

Torridge's SOAP API changed its response from explicit dates ("Mon 14 Apr")
to relative phrases ("Tomorrow then every Mon", "Today then every Tue")
with an embedded calendar table. The old regex-based parser returned empty
because it expected the old format.

The rewritten parser handles Today/Tomorrow/weekday-name phrases, falls back
to the old explicit format if it reappears, and gracefully skips "No X
collection for this address" entries.
The Wyre bin collection page now includes a 'Download calendar' box
among the .boxed divs. This box has no h3.bin-collection-tasks__heading,
which caused the scraper to crash on .text access.

Changes:
- Skip boxes missing the heading or content container
- Use regex to extract the bin name from 'Your next X collection'
- Collapse whitespace on the date text before strptime (p tags produced
  multi-whitespace runs after .text)
- Roll year forward only when the computed date is in the past, instead
  of only handling the December->January edge case
…e results

The checkyourbinday page is now:
- Gated by Cloudflare Turnstile (requires non-headless UC)
- Using WASTECOLLECTIONCALENDARV7_* element IDs (was V5)
- Rendering collection dates inline as .gi-summary-blocklist__row
  divs after address selection — no separate NEXT/submit step

Changes:
- Update all element IDs from V5 to V7
- Add Cloudflare challenge wait loop (up to 50s)
- Dismiss cookie consent before interaction (was blocking button clicks)
- Replace old table-based parsing with .gi-summary-blocklist__row scraping
- Use Select.select_by_visible_text with stale-retry instead of manual
  option.click() loop (which crashed on AJAX re-renders)
- Remove the smart_select_address helper's dead fuzzy/strict split
…anner

Stockton's AchieveForms form name changed from LOOKUPBINDATESBYADDRESSSKIPOUTOFREGION
to LOOKUPBINDATESBYADDRESSSKIPOUTOFREGIONV2, so every element ID needed
the V2 suffix added. Also added a cookie-banner dismissal step — the
banner was covering the search button and intercepting clicks.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

Warning

Rate limit exceeded

@InertiaUK has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 45 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 45 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b05cb9a-d186-4dd2-8870-7799f4583a5f

📥 Commits

Reviewing files that changed from the base of the PR and between 60bd3cc and c8f1b71.

📒 Files selected for processing (5)
  • uk_bin_collection/tests/input.json
  • uk_bin_collection/uk_bin_collection/councils/ChichesterDistrictCouncil.py
  • uk_bin_collection/uk_bin_collection/councils/StocktonOnTeesCouncil.py
  • uk_bin_collection/uk_bin_collection/councils/TorridgeDistrictCouncil.py
  • uk_bin_collection/uk_bin_collection/councils/WyreCouncil.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant