title: Get html content from webView in Swift?
body: <p>I have the webView shows the content like the image. My purpose is that i want to print out exactly the string <code>Thanh toán thành công</code> and i don't want to get any html format. Please help me how to handle it. Appreciate your helping !</p>
  
  <p><a href="https://i.stack.imgur.com/vpU6j.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vpU6j.jpg" alt="enter image description here"></a></p>
  
  <p>My code:</p>
  
  <pre><code>func webViewDidFinishLoad(_ webView: UIWebView) {
      print("pageDidFinished")
      if let html = webView.stringByEvaluatingJavaScript(from: "document.body.innerHTML") {
          print("html=[\(html)]")
      }
  }
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>html=[
      &lt;form name="form1" method="post" action="Vnpay_return.aspx?vnp_Amount=1000000&amp;amp;vnp_BankCode=NCB&amp;amp;vnp_BankTranNo=20181129164553&amp;amp;vnp_CardType=ATM&amp;amp;vnp_OrderInfo=Thanh+toan+goi+kham+iCNM&amp;amp;vnp_PayDate=20181129164626&amp;amp;vnp_ResponseCode=00&amp;amp;vnp_TmnCode=MLATEC02&amp;amp;vnp_TransactionNo=13115440&amp;amp;vnp_TxnRef=636791069787342509&amp;amp;vnp_SecureHashType=MD5&amp;amp;vnp_SecureHash=8e346e3b07cae8655972bec0e68f30e0" id="form1"&gt;
  &lt;div&gt;
  &lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTIxMzA2NDI4Ng9kFgICAw9kFgICAQ8WAh4JaW5uZXJodG1sBSRUaGFuaCB0byYjMjI1O24gdGgmIzIyNDtuaCBjJiMyNDQ7bmdkZCNmBqLZpz4DIdi6COyJTTG5SVGH"&gt;
  &lt;/div&gt;
  
  &lt;div&gt;
  
      &lt;input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C462C8FC"&gt;
  &lt;/div&gt;
       &lt;div class="container"&gt;
              &lt;div class="header clearfix"&gt;
  
                  &lt;h3 class="text-muted"&gt;Kết quả thanh toán&lt;/h3&gt;
              &lt;/div&gt;
              &lt;div class="table-responsive"&gt;
                   &lt;div id="displayMsg"&gt;Thanh toán thành công&lt;/div&gt;
              &lt;/div&gt; &lt;/div&gt;
      &lt;/form&gt;
  
    &lt;script src="../js/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css"&gt;
  
  ]
  </code></pre>