Skip to content

fix: updated ID's for multiple elements that had changed#1854

Open
Chewbacca222222 wants to merge 1 commit intorobbrad:masterfrom
Chewbacca222222:swale-council-fix
Open

fix: updated ID's for multiple elements that had changed#1854
Chewbacca222222 wants to merge 1 commit intorobbrad:masterfrom
Chewbacca222222:swale-council-fix

Conversation

@Chewbacca222222
Copy link

@Chewbacca222222 Chewbacca222222 commented Feb 12, 2026

Update multiple ID's that had changed on the Swale Council website. Tested locally and all was working fine.

It may be worth considering changing from ID's to something a little more robust, I have little experience using Selenium so didn't really want to start that. Just a thought :)

Cheers.

Summary by CodeRabbit

  • Bug Fixes
    • Updated Swale Borough Council integration to work with the latest website changes, ensuring accurate bin collection data retrieval.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Updated Selenium WebDriver element selectors in the SwaleBoroughCouncil web scraper module to accommodate changes in the target website's HTML structure. Four selector identifiers were modified: postcode input field, address search button, address dropdown, and bin search submit button. No functional logic changes.

Changes

Cohort / File(s) Summary
Selenium Selector Updates
uk_bin_collection/uk_bin_collection/councils/SwaleBoroughCouncil.py
Updated four Selenium WebDriver element selectors: postcode input (By.ID: q485476_q1 → q499089_q1), address submit button (By.ID: form_email_485465_submit → form_email_499078_submit), address dropdown (name: q485480:q1 → q499093:q1), and bin search button (By.ID: form_email_485465_submit → form_email_499078_submit).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • dp247

Poem

🐰 With whiskers twitching, I hop through selectors new,
Where IDs change and XPaths are renewed,
The bins still gleam, the forms still flow,
Just swap the names, and off we go!

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: updating IDs for multiple elements that had changed, which matches the actual changeset in SwaleBoroughCouncil.py.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
uk_bin_collection/uk_bin_collection/councils/SwaleBoroughCouncil.py (1)

49-55: Pre-existing: inner exception is silently swallowed.

This except block catches all exceptions, prints a message, but doesn't re-raise. If the postcode field fails to load (e.g., the ID changes again), execution silently continues to line 58, which will then timeout with a less informative error. Consider re-raising here so failures are caught early with a clear cause.

Suggested improvement
             try:
                 inputElement_postcode = WebDriverWait(driver, 10).until(
                     EC.presence_of_element_located((By.ID, "q499089_q1"))
                 )
                 inputElement_postcode.send_keys(user_postcode)
             except Exception:
-                print("Page failed to load. Probably due to Cloudflare robot check!")
+                raise ValueError(
+                    "Page failed to load (postcode field not found). "
+                    "Possibly due to Cloudflare robot check or changed element IDs."
+                )

Based on learnings: "prefer explicit failures (raise exceptions on unexpected formats) over silent defaults or swallowed errors."

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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