0
我正嘗試使用Nightmarejs從我的服務器下載其中一個PDF。我已經通過節點模塊安裝爲: -如何在NightmareJs中禁用顯示打印機提示
npm install nightmare
,並寫下了下面的代碼: -
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: false})
nightmare
.goto(url) // url of my site
.size()
.type('[name=email]', '')
.type('[name=email]', '[email protected]')
.type('[name=password]', 'test')
.click('#signInSubmit')
.wait(2000)
.pdf("test.pdf")
.evaluate(function() {
return document
})
.end()
.then(function (result) {
console.log(result)
})
.catch(function (error) {
console.error('Search failed:', error);
});
將PDF文件保存到我的當前目錄,但我也電子設置爲false它不會顯示瀏覽器,但它會顯示打印機設置提示打印我只是不需要提示出現。我只想知道我該如何實現這一點。正如我谷歌它會給我設置沉默爲真,但我不知道我應該在哪裏設置沉默的真正選項。
var nightmare = Nightmare({ show: false})
我的意思是如何以及在哪裏配置夢魘js腳本文件中的電子設置。