title: Get HTML source of WebElement in Selenium WebDriver using Python
body: <p>I'm using the Python bindings to run Selenium WebDriver:</p>
  <pre><code>from selenium import webdriver
  wd = webdriver.Firefox()
  </code></pre>
  <p>I know I can grab a webelement like so:</p>
  <pre><code>elem = wd.find_element_by_css_selector('#my-id')
  </code></pre>
  <p>And I know I can get the full page source with...</p>
  <pre><code>wd.page_source
  </code></pre>
  <p>But is there a way to get the &quot;element source&quot;?</p>
  <pre><code>elem.source   # &lt;-- returns the HTML as a string
  </code></pre>
  <p>The Selenium WebDriver documentation for Python are basically non-existent and I don't see anything in the code that seems to enable that functionality.</p>
  <p>What is the best way to access the HTML of an element (and its children)?</p>