Skip to content

Commit

Permalink
Revert "fix: Rushcliffe Borough Council"
Browse files Browse the repository at this point in the history
This reverts commit 40493f0.
  • Loading branch information
m26dvd committed Jan 15, 2025
1 parent bcef5f4 commit c004c2e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
8 changes: 8 additions & 0 deletions uk_bin_collection/tests/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit c004c2e

Please sign in to comment.