0

im trying to get the HTML document in order to parse or manipulate it, but the only thing i found is a print in console function

webView.evaluateJavaScript("document.documentElement.outerHTML.toString()", completionHandler: { (html: Any?, error: Error?) in print(html) })

Could be a way to store the html var into a swift string var?

thanks:)

  • Already solved click [here for the answer](https://stackoverflow.com/questions/31080818/what-is-the-best-practice-to-parse-html-in-swift) – valentinv Jul 01 '19 at 14:06
  • 1
    but i don't see the way to get the html with the WebKit there – Eduardo Chaparro Alire Jul 01 '19 at 14:40
  • Here you can find how to get the html from wkwebview https://stackoverflow.com/questions/34751860/get-html-from-wkwebview-in-swift – valentinv Jul 02 '19 at 12:49
  • can't make it work with that code, seems like that was an older version of WebKit, and needs another function params.. Even if worked, they never fetch the HTML to manipulate it, only a console print :/ that is how i reached to print in the above code – Eduardo Chaparro Alire Jul 02 '19 at 16:10

0 Answers0