SaikiHanee SaikiHanee - 1 year ago 123
Python Question

Access and webscrape dynamic pages using python

I am trying to access a web page using it's form parameters.
I found the form parameters using Network headers in chrome's developer tab.
But it's not working, instead it's just opening the page before these parameters are used (i.e

import webbrowser'')

My intention is to retrieve all the tables of each District Electoral Division of all the counties.

enter image description here

Answer Source

webbrowser doesn't do what you think it does.

If you want to get/post data to a webpage, you should use requests

>>> import requests
>>> r = requests.get('')
>>> r ='', data = {'key':'value'})

webbrowser is for launching your web browser.

Note that this won't work very well if there's a bunch of javascript in use (well, it might, but it requires a lot more work on your part). If you have a lot of Javascript, it may be easier to use selenium

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download