Search code examples
c#seleniumwebdriverinnerhtmlouterhtml

C# Selenium how to get outerhtml of a element's all childs


Here's a html code;

<div id="div-f2qqs">
   <table class="table table-hover table-bordered">
      ....
   </table>
   <div class="head-2"></div>
      <p></p>
      <li></li>
  </div>

I want to get all div-f2qqs's child of outerHTML. How can I do it can anyone help me?


Solution

  • Try

    (//div[@id='div-f2qqs']).GetAttribute("outerHTML");
    

    Let me know if this works