Below is simple code that click the login button of wp-login page. I want to print the request that is being made by selenium on button click. Is it possible using selenium. If not is there any other possible way.
def init_driver():
driver = webdriver.PhantomJS()
driver.wait = WebDriverWait(driver, 5)
return driver
def clickButton(driver):
driver.get("http://website.com/wp-login.php")
try:
button = driver.wait.until(EC.element_to_be_clickable(
(By.NAME, "wp-submit")))
button.click()
except TimeoutException:
print("Button not found in google.com")
if __name__ == "__main__":
driver = init_driver()
clickButton(driver)
driver.quit()
Below is the request that I capture on button click using burpsuite that I want to print in python:
POST /wp-login.php HTTP/1.1
Host: website.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: http://website.com/wp-login.php
Cookie: wordpress_test_cookie=WP+Cookie+check; AWSELB=7DdsfsdfsdsfgeredfgfebfgrehgfdcxBD20E6
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 94
log=&pwd=&wp-submit=Log+In&redirect_to=http%3A%2F%2Fwebsite.com%2Fwp-admin%2F&testcookie=1
Below solution does not work for me
How can I see the entire HTTP request that's being sent by my Python application?
As I wanted to print request on button click.