Is it possible to Capture POST data in Selenium? Is it possible to Capture POST data in Selenium? selenium selenium

Is it possible to Capture POST data in Selenium?


You are going to have to put a proxy in the middle and monitor that proxy. You can use http://pypi.python.org/pypi/browsermob-proxy. that allows you to pass in proxy details to WebDriver and then you can pull out a HAR file which shows all the network traffic.

You can also use HARPy to then get the info you want

Example of BrowserMob Proxy and Selenium

            from browsermobproxy import Server            server = Server("path/to/browsermob-proxy")            server.start()            proxy = server.create_proxy()            from selenium import webdriver            profile  = webdriver.FirefoxProfile()            profile.set_proxy(proxy.selenium_proxy())            driver = webdriver.Firefox(firefox_profile=profile)            proxy.new_har("google")            driver.get("http://www.google.co.uk")            proxy.har # returns a HAR JSON blob            proxy.stop()            driver.quit()