title: How to get HTML code of a WebElement in Selenium
body: <p>I am new at testing so my apologies in advance if my question sounds a bit primary.</p>
  
  <p>I am using Selenium and Java to write a test. </p>
  
  <p>I know that 
  <code>webElement.getAttribute("innerHTML");</code> brings me the innerHTML, for example for the element below:</p>
  
  <pre><code>&lt;a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" style="position: absolute; border-radius: 0px 0px 4px 4px;"&gt;
      &lt;span class="ui-icon ui-icon-closethick"&gt;close&lt;/span&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>it returns:</p>
  
  <pre><code>&lt;span class="ui-icon ui-icon-closethick"&gt;close&lt;/span&gt;
  </code></pre>
  
  <p>but I need something that brings me the inner attribute of WebElement "a", something like below:</p>
  
  <pre><code>href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" style="position: absolute; border-radius: 0px 0px 4px 4px;"
  </code></pre>