From c004c2e88cb5ebca7e00c37a73a4f73897b2f588 Mon Sep 17 00:00:00 2001 From: m26dvd <31007572+m26dvd@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:16:08 +0000 Subject: [PATCH] Revert "fix: Rushcliffe Borough Council" This reverts commit 40493f0e52639883c0de6db21e6a0ca017c3f313. --- uk_bin_collection/tests/input.json | 8 ++++ .../councils/RushcliffeBoroughCouncil.py | 37 ++++++------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/uk_bin_collection/tests/input.json b/uk_bin_collection/tests/input.json index 74e5718e21..5726adbbb5 100755 --- a/uk_bin_collection/tests/input.json +++ b/uk_bin_collection/tests/input.json @@ -1418,6 +1418,14 @@ "wiki_name": "Powys Council", "wiki_note": "Pass the house name/number and postcode in their respective parameters. This parser requires a Selenium webdriver." }, + "PowysCouncil": { + "house_number": "LANE COTTAGE", + "postcode": "HR3 5JS", + "skip_get_url": true, + "url": "https://www.powys.gov.uk", + "web_driver": "http://selenium:4444", + "wiki_name": "Powys Council" + }, "PrestonCityCouncil": { "house_number": "Town Hall", "postcode": "PR1 2RL", diff --git a/uk_bin_collection/uk_bin_collection/councils/RushcliffeBoroughCouncil.py b/uk_bin_collection/uk_bin_collection/councils/RushcliffeBoroughCouncil.py index d524eb2a94..579cb59675 100644 --- a/uk_bin_collection/uk_bin_collection/councils/RushcliffeBoroughCouncil.py +++ b/uk_bin_collection/uk_bin_collection/councils/RushcliffeBoroughCouncil.py @@ -37,52 +37,37 @@ def parse_data(self, page: str, **kwargs) -> dict: # Populate postcode field inputElement_postcode = driver.find_element( By.ID, - "FF3518-text", + "ctl00_ContentPlaceHolder1_FF3518TB", ) inputElement_postcode.send_keys(user_postcode) # Click search button driver.find_element( By.ID, - "FF3518-find", + "ctl00_ContentPlaceHolder1_FF3518BTN", ).click() # Wait for the 'Select address' dropdown to appear and select option matching UPRN dropdown = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((By.ID, "FF3518-list")) - ) - - WebDriverWait(driver, 10).until( - EC.element_to_be_clickable( - ( - By.XPATH, - f"//select[@id='FF3518-list']/option[starts-with(@value, 'U{user_uprn}')]", - ) + EC.presence_of_element_located( + (By.ID, "ctl00_ContentPlaceHolder1_FF3518DDL") ) - ).click() - - """# Create a 'Select' for it, then select the matching URPN option + ) + # Create a 'Select' for it, then select the matching URPN option dropdownSelect = Select(dropdown) - target_prefix = "U" + user_uprn - for option in dropdownSelect.options: - option_value = option.get_attribute("value") - if option_value.startswith(target_prefix): # Search by visible text - dropdownSelect.select_by_visible_text(option.text) - # dropdownSelect.select_by_value("U" + user_uprn)""" + dropdownSelect.select_by_value("U" + user_uprn) # Wait for the submit button to appear, then click it to get the collection dates submit = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((By.ID, "submit-button")) + EC.presence_of_element_located( + (By.ID, "ctl00_ContentPlaceHolder1_btnSubmit") + ) ) submit.click() - WebDriverWait(driver, 10).until( - EC.presence_of_element_located((By.CLASS_NAME, "ss_confPanel")) - ) - soup = BeautifulSoup(driver.page_source, features="html.parser") - bins_text = soup.find("div", id="body-content") + bins_text = soup.find("div", id="ctl00_ContentPlaceHolder1_pnlConfirmation") if bins_text: results = re.findall(