我用uiwebview 加载了一个url连接, 我怎么能查看uiwebview加载后的生成的html源码, 我想查看里面的元素结构
光阴似箭催人老,日月如移越少年。
In the webViewDidFinishLoad proxy method
NSString *jsToGetHTMLSource = @"document.documentElement.innerHTML"; if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { NSString *AllHtml = [self.testWebView stringByEvaluatingJavaScriptFromString:jsToGetHTMLSource]; [self analysisWebViewSourceCode:AllHtml]; }else { [self.wkWebView evaluateJavaScript:jsToGetHTMLSource completionHandler:^(id _Nullable string, NSError * _Nullable error) { [self analysisWebViewSourceCode:string]; }];
This way you can get the source code of html.
Obviously use Safari The developer menu of the browser to do this...
Safari
In the webViewDidFinishLoad proxy method
This way you can get the source code of html.
Obviously use
Safari
The developer menu of the browser to do this...