Reputation: 320
I have a website that has three drop downs one for country then state/REgion/Province and then the corresponding city.
After we select the country the state dropdown shows the corresponding values and then when we select one of the states the city drop down shows the entire city list and finally when we select the city it shows a table as an output that i want to scrape for every countries state's city...
I have tried to accomplish this task but in vain if any one could help me following is the website:https://shipped.com/shipping-containers-for-sale.php
Upvotes: 1
Views: 259
Reputation: 370
It is quite simple. If you click all the 'country', 'states', and 'cities' sections it moves to a certain page. In the HTML source of that page, there exists source code as below:
<select name="state" id="state" class="radius" required> == $0
which has a list of option values of state names.
Also, the next sibling of the above code is stated as:
<select id="city" name="city" class="radius" onchange="this.form.submit()">
that has list of city names. What you have to do is iterate through the state names and get the list of the city names. Method such as .find_element_by_id
and .find_element_by_name
will be extremely helpful.
Hope this helps!
Upvotes: 2