我用uiwebview 加载了一个url连接, 我怎么能查看uiwebview加载后的生成的html源码, 我想查看里面的元素结构
天蓬老师2017-04-18 09:17:52
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.