- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我很难过要在Travis CI上运行它。它会间歇性地工作,但 Nightmare 通常会因以下错误而失败:
nightmare:log did-get-response-details [{},false,"https://fonts.gstatic.com/s/roboto/v16/Hgo13k-tfSpn0qi1SFdUfVtXRa8TVwTICgirnJhmVJw.woff2","https://fonts.gstatic.com/s/roboto/v16/Hgo13k-tfSpn0qi1SFdUfVtXRa8TVwTICgirnJhmVJw.woff2",200,"GET","https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons",{"accept-ranges":["bytes"],"access-control-allow-origin":["*"],"age":["706260"],"alt-svc":["quic=\":443\"; ma=2592000; v=\"37,36,35\""],"cache-control":["public, max-age=31536000"],"content-length":["14696"],"content-type":["font/woff2"],"date":["Mon, 17 Apr 2017 21:24:49 GMT"],"expires":["Tue, 17 Apr 2018 21:24:49 GMT"],"last-modified":["Tue, 04 Apr 2017 18:34:45 GMT"],"server":["sffe"],"status":["200"],"timing-allow-origin":["*"],"x-content-type-options":["nosniff"],"x-xss-protection":["1; mode=block"]},"other"] +0ms
nightmare:log did-stop-loading [{}] +276ms
nightmare:log crashed [{},false] +1ms
nightmare:actions .wait() for .main-container element or 1000msec +29s
nightmare:actions .evaluate() fn on the page +1s
/home/travis/build/esalter-va/esalter-va.github.io/node_modules/webpack-static-site-generator/render.js:30
setTimeout(function () {throw err})
^
Error: Evaluation timed out after 30000msec. Are you calling done() or resolving your promises?
at Timeout._onTimeout (/home/travis/build/esalter-va/esalter-va.github.io/node_modules/nightmare/lib/actions.js:509:10)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
// plugin: index.js
if (process.platform === 'linux'){
xvfb.startSync()
process.env['DISPLAY'] = ':99.0'
}
var server = serve(self.outputPath)
var port = server.address().port
var outputFiles = render(port, self.routes, self.elementToWaitFor)
outputFiles.then(files => {
for (var i = 0; i < files.length; i++) {
var outputFilePath = path.join(self.outputPath, self.routes[i])
var outputFileName = path.join(outputFilePath, 'index.html')
fsPath.writeFile(outputFileName, files[i])
}
server.close(function () {
xvfb.stopSync()
done()
})
}).catch(err => {
setTimeout(function () {throw err})
server.close(function () {
xvfb.stopSync()
done()
})
})
// plugin: render.js (where `var outputFiles = render(port, self.routes, self.elementToWaitFor)` goes)
function render(port, routes, elementToWaitFor) {
var nightmare = Nightmare({
show: false,
webPreferences: {
partition: 'partition-' + Math.random()
}
})
var baseUrl = `http://localhost:${port}`
var pageContents = routes.reduce(function (accumulator, route) {
return accumulator.then(function (results) {
var url = baseUrl + route
return nightmare
.goto(url)
.wait(elementToWaitFor, 1000)
.evaluate(function () {
return document.documentElement.innerHTML
})
.then(function (content) {
results.push(content)
return results
})
.catch(err => {
setTimeout(function () {throw err})
})
})
}, Promise.resolve([]))
return pageContents.then(function (values) {
return nightmare.end().then(function () {
return values
})
}).catch(err => {
setTimeout(function () {console.log(`Error ${err}`)})
})
}
# .travis.yml (project that uses plugin)
language: node_js
node_js:
- "node"
addons:
apt:
packages:
- xvfb
- libxss1
script:
- yarn run lint
- yarn run build
// package.json
"scripts": {
"build": "DEBUG=nightmare:*,electron:* node build/build.js",
},
Nightmare({show: false})
Nightmare({webPreferences: {partition: 'partition-' + Math.random()}
.wait()
apt
包作为在线上的不同帖子,建议最佳答案
通过将sudo: required
添加到我的.travis.yml
中,似乎可以解决此问题。
关于webpack - Nightmare 在特拉维斯坠毁: `nightmare:log crashed [{},false]` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43624960/
好吧,我用 Nightmare 来做一些测试任务,对于基于电子和phatomjs的代码来说是如此的好。 现在,我有一个问题,我该如何通过 Nightmare 上传图像文件? 好吧,我找到了一个名为ni
我找不到这方面的任何信息,主要是因为一旦我在同一句话上输入带有“Nightmare ”和“IE”的google搜索,您就会知道... 有没有办法像在IE兼容模式下一样运行nightmare.js? 最
我试图从网站中提取数据,我想在 10 分钟后循环查看数据是否已更改。我认为将我的功能打包在模块中是一个好主意,但现在我坚持将我当前的 Nightmare 实例从登录模块转移到数据模块。 开始.js v
我很难过要在Travis CI上运行它。它会间歇性地工作,但 Nightmare 通常会因以下错误而失败: nightmare:log did-get-response-details [{},f
使用nightmarejs如何在文件输入中输入文件并进行确认? 它用于附件的自动化(例如电子邮件)。我的意思是输入文件是这样的: 最佳答案 我所知道的使用Nightmare进行上传的唯一方法是使用de
我想抓取并通过页面中的每个herf获取html,然后输出到csv。现在我第一次使用 Nightmare 。所以我对未定义的段落有疑问。 var Nightmare = require('nightma
var Nightmare = require('nightmare'); var nightmare = Nightmare({ show: true }); var fs = require('
我目前正在开发一个程序来自动化某个网站上的任务(简化代码如下)。我很好地登录,然后等待页面加载,但是wait函数永远不会结束。我尝试使用wait(200),但是评估函数返回一个空数组。我100%确信网
我尝试在F12时单击包含这些详细信息的按钮 Show all results for 'lundhags' 我已经复制了xpath并且有这样的代码=>I.click('//*[@id="9"]');
我在javascript中使用Nightmare创建网络抓取工具,但是评估功能未返回正确的信息。似乎它能够返回原始类型(int,字符串等),但不能返回“querySelectorAll”中的元素列表。
我正在尝试NightmareJS进行一些我想完成的自动化操作。我遇到的一个问题是, Nightmare/Electron 无法解析adidas网站,但是它可以解析并访问任何其他网页。 This is
我想使用 Nightmare JS 通过检查状态代码 200 来确定页面是否正在加载。我查看了 goto 选项,但无法弄清楚。大家有什么想法吗? var Nightmare = require('ni
我刚刚开始使用 Nightmare 。我在我的网页上使用它用于测试目的。 我有以下用户界面。 menu tab1 | tab2 | tab3 ......(dynamically generated
如何使用 nightmare-iframe 插件访问具有随机生成名称的 iframe? 我试过了 var name = yield nightmare .goto(defaultUrl) .c
如何在服务器上通过pm2或类似的东西运行nightmarejs,因为 Nightmare 使用电子,而电子现在需要图形,我正在使用xvfb-run npm start ,但是这个 sol° 需要我通过
下面的代码片段是来自 https://github.com/segmentio/nightmare 的示例 const Nightmare = require('nightmare') const n
我知道在任何环境中处理日期都可能会非常令人困惑,但我正处于一场噩梦中,这个函数本应该是一项微不足道的工作。我想以不同的方式操作某些日期,但出现错误或错误的结果。 下面我将报告一个非常简单的例子来测试执
我有以下代码: for(var i = 0; i { return true; }) } 我正在 Electron 应用程序中使用它。然而,这会执行异步,我会立
我正在尝试使用 github.com/segmentio/nightmare 自动化 2 个站点 例子: 我想继续访问 site_1(临时电子邮件服务)并获得电子邮件。 然后转到 site_2 并填写
我正在尝试使用 Nightmare 抓取网页,但想等待 #someelem 出现,前提是它确实存在。否则,我希望 Nightmare 继续前进。如何使用 .wait() 完成此操作? 我不能使用 .w
我是一名优秀的程序员,十分优秀!