Skip to content

fix: BostonBoroughCouncil - drive chosen.js widget for renamed ADDRESSUPRN select#1972

Closed
InertiaUK wants to merge 1 commit into
robbrad:masterfrom
InertiaUK:fix/boston-addressuprn-chosen-widget
Closed

fix: BostonBoroughCouncil - drive chosen.js widget for renamed ADDRESSUPRN select#1972
InertiaUK wants to merge 1 commit into
robbrad:masterfrom
InertiaUK:fix/boston-addressuprn-chosen-widget

Conversation

@InertiaUK
Copy link
Copy Markdown
Contributor

Problem

Boston's V2 collection form now uses BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSUPRN for the address select (was ADDRESSSELECTION), and wraps it in a chosen.js widget which hides the underlying <select>.

Symptoms against live data:

  • Old XPath //select[contains(@id,'ADDRESSSELECTION')] never matches, triggering TimeoutException at the "Wait for the address dropdown" step.
  • If the select is located by the renamed ID, clicking an <option> inside it raises ElementNotInteractableException: Element is not currently visible because chosen hides it.

Live IDs captured after postcode search (PE20 1AY):

```
BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSUPRN (native ) BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSUPRN_chosen (chosen container) BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSUPRN_chosen_search_input BBCWASTECOLLECTIONSV2_ADDRESS_NEXT3_NEXT ``` Fix Wait on either ADDRESSUPRN or ADDRESSSELECTION so the scraper survives another flip. Drive the chosen widget directly: click it open, type the paon into chosen-search-input to filter, then click the matching active-result li. Use contains(., '...') instead of contains(text(), '...') because chosen wraps matched substrings in <em> elements, which breaks text() direct-child matching. Keep a JS fallback that sets the native <select>'s value and fires change / chosen:updated in case a future layout drops the chosen widget. Verification Fixture postcode PE20 1AY + paon CEDAR (from tests/input.json) now returns 3 bins: ``` Purple/Purple-lidded Paper/Card Bin 23/04/2026 Green Refuse Bin 30/04/2026 Blue Recycling Bin 07/05/2026 ``` Requires undetected-chromedriver / a CF-bypassing driver (site is Cloudflare-protected) — unchanged from prior behaviour.

…s select

The V2 form renames the address field ID from
BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSSELECTION to
BBCWASTECOLLECTIONSV2_ADDRESS_ADDRESSUPRN. The old XPath no longer
matches so the scraper times out waiting for the dropdown.

Additionally, chosen.js hides the underlying <select>, so clicking an
<option> inside it raises ElementNotInteractableException. Drive the
chosen widget directly instead: open it, type into the search input to
filter, then click the matching active-result li. Use contains(.,)
rather than contains(text(),) because chosen wraps matched characters
in <em> elements which breaks direct text() matching.

Accept both old and new IDs so the scraper keeps working if Boston
flips the rename back, and fall back to driving the native select via
JS when no chosen container is present.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@InertiaUK has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 26 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 59 minutes and 26 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: 1c730454-23a2-408d-ba9e-42d73e4370cd

📥 Commits

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

📒 Files selected for processing (1)
  • uk_bin_collection/uk_bin_collection/councils/BostonBoroughCouncil.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.

@robbrad robbrad mentioned this pull request May 1, 2026
@robbrad
Copy link
Copy Markdown
Owner

robbrad commented May 1, 2026

Included in May 2026 Release PR #1992. Closing.

@robbrad robbrad closed this May 1, 2026
@robbrad robbrad mentioned this pull request May 2, 2026
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.

2 participants