How to read console logs of wkwebview programmatically

NaveenKumar picture NaveenKumar · May 11, 2016 · Viewed 15.5k times · Source

I am trying to read the console logs of webapp that is loaded in my WkWebview programmatically.

so far in my research it's not possible.

How can I achieve this?

Answer

Oded Regev picture Oded Regev · Dec 27, 2018

It's possible to connect Safari browser on you Mac to the WKWebView and get access to the console.

From Safari, open "Develop" tab and while the iOS Simulator is running with the WKWebView open - just click it to open the console. See:

enter image description here