node.js - 带有cheerio选择器的Nightmarejs返回所有DOM而不是选定元素
问题描述
在将 nightmarejs 与 Cheerio 配对时遇到了一些问题。尝试将生成的 document.body.innerHTML 从评估传递给cheerio,就像这样
...
var title = yield nightmare.goto(urls[i])
.wait('.result-title')
.evaluate(() => document.body.innerHTML)
.then(function (html) {
const $ = cheerio.load(html);
...
但是在调用 console.log($('.address-text')); 我看到了一个永无止境的 DOM 结构。如此屏幕截图所示,这种情况已经持续了很长时间
解决方案
推荐阅读
- ios - 如何使用 Swift 4 设置 UITextField 边框从左到右的渐变和圆角
- git - 进行bitbucket合并时如何省略一些代码
- python - 如果 SQLAlchemy 中尚未包含大量记录,则将它们添加到 SQL 数据库
- c# - 只获得第一
- 的
- 的
- biztalk - BizTalk 2013 r2 管理控制台在 MS 安全更新 KB4338815 后无法打开
- back - Gupshup 聊天机器人中的“重新开始”按钮
- javascript - 检查数据库中“单词”集合中的所有单词,并检查文本中的任何单词是否与任何单词匹配
- android - xamarin live player 可视化错误目标 add 为 null
- python - 如何阻止我的熊猫数据表在打印时被截断?
- unity3d - 使用网络管理器中内置的统一有什么缺点?