Splinter or Selenium: Can we get current html page after clicking a button? Splinter or Selenium: Can we get current html page after clicking a button? selenium selenium

Splinter or Selenium: Can we get current html page after clicking a button?


With Selenium, assuming that driver is your initialized WebDriver object, this will give you the HTML that corresponds to the state of the DOM at the time you make the call:

driver.execute_script("return document.documentElement.outerHTML;")

The return value is a string so you could do:

print(driver.execute_script("return document.documentElement.outerHTML;"))


When I use Selenium for tasks like this, I know browser.page_source does get updated.