我正在构建一个爬虫但我需要爬取 iframe 内容 chrome-remote-interface 没有转储 iframe 内容有什么办法吗?
代码
CDP.New({'url':url},(err,target) => {
if(!err){
CDP({target},(client) => {
const {Network, Page, Runtime} = client;
Network.setUserAgentOverride({'userAgent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36'});
Network.enable();
Page.enable();
Runtime.enable();
Page.navigate({url});
Page.loadEventFired(() => {
Runtime.evaluate({
//I have no idea what to do ..
expression:'document.documentElement',
returnValue:true})
.then(({result}) => {
cb(null,{html:result.value})
CDP.Close({id:target.id})
})
})
})