Introduction
Building on the basics, this tutorial demonstrates how to scrape daily weather observations from Taiwan’s CODiS service using Selenium.
About CODiS
The CODiS portal lets users query station data for specific dates, but the new version uses sessions and POST requests, making traditional API calls harder. Selenium simulates user actions to retrieve the formatted tables.
Workflow
- Open the CODiS site and locate station markers on the interactive map.
- Click a region, then a specific station.
- Choose the desired date and submit the form.
- Wait for the result table to render and extract data.
Sample Code
|
|
Include proper waits (e.g., WebDriverWait
) to handle dynamic loading.
Saving Results
Write the scraped rows to CSV for later analysis.
Conclusion
Selenium enables automated access to CODiS’s processed tables when direct API fetching is inconvenient.