element = driver.find_element_by_xpath('//*') element = element.get_attribute('innerHTML') code example Example: python selenium get html content element.get_attribute('innerHTML')