Skip to content

Commit 2051201

Browse files
authored
Merge pull request #1474 from Toriniasty/feature/fix-Croydon
Simplify and fix wait for content, fixes Croydon council
2 parents b4609ac + e310ea3 commit 2051201

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

uk_bin_collection/tests/input.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,9 @@
614614
"postcode": "SE25 5DW",
615615
"skip_get_url": true,
616616
"url": "https://service.croydon.gov.uk/wasteservices/w/webpage/bin-day-enter-address",
617+
"web_driver": "http://selenium:4444",
617618
"wiki_name": "Croydon",
618-
"wiki_note": "Pass the house number and postcode in their respective parameters.",
619+
"wiki_note": "Pass the house number and postcode in their respective parameters. This parser requires a Selenium webdriver.",
619620
"LAD24CD": "E09000008"
620621
},
621622
"CumberlandAllerdaleCouncil": {
@@ -745,7 +746,7 @@
745746
"wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find the UPRN.",
746747
"LAD24CD": "E07000061"
747748
},
748-
"EastCambridgeshireCouncil": {
749+
"EastCambridgeshireCouncil": {
749750
"skip_get_url": true,
750751
"uprn": "10002597178",
751752
"url": "https://www.eastcambs.gov.uk/",
@@ -2803,4 +2804,4 @@
28032804
"wiki_note": "Provide your UPRN.",
28042805
"LAD24CD": "E06000014"
28052806
}
2806-
}
2807+
}

uk_bin_collection/uk_bin_collection/councils/CroydonCouncil.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,9 @@ def parse_data(self, page: str, **kwargs) -> dict:
7979
next_button.click()
8080

8181
# Wait for the bin collection content to load
82-
collection_content = WebDriverWait(driver, 10).until(
83-
EC.presence_of_element_located(
84-
(
85-
By.XPATH,
86-
'//*[@id="mats_content_wrapper"]/div[2]/div[2]/div[2]/div/div[1]/div/div[3]/div/div/div/div',
87-
)
82+
listing_records = WebDriverWait(driver, 10).until(
83+
EC.presence_of_all_elements_located(
84+
(By.CSS_SELECTOR, "#mats_content_wrapper .listing_template_record")
8885
)
8986
)
9087

0 commit comments

Comments
 (0)