nightmare

Nightmare conditional wait()

六眼飞鱼酱① 提交于 2019-12-29 08:07:40
问题 I'm trying to crawl a webpage using Nightmare, but want to wait for #someelem to be present, only if it actually exists. Otherwise, I want Nightmare to move on. How can this be done using .wait() ? I can't use .wait(ms) . Using .wait(selector) means Nightmare will keep waiting until the element is present, but if the page will never have this element, Nightmare will keep waiting forever. The last option is to use .wait(fn) . And I've tried something like this .wait(function(cheerio) { var $ =

Reuse electron session with nightmare

守給你的承諾、 提交于 2019-12-25 11:53:11
问题 I am using Nightmare.js to print pdf's. I send a request to the node server and build the page, using Nightmare to ensure the page has loaded, then print a pdf. But for each request I create a new electron window, how do I reuse the same window, or a pool of max X electron windows, to handle my pdf printing? var nightmare = require('nightmare'), http = require('http'); function createPage(o, final) { var page = nightmare() .goto('file:\\\\' + __dirname + '\\index.html'); .wait(function () {

Clicking an image with nightmarejs

丶灬走出姿态 提交于 2019-12-23 17:50:43
问题 I've been struggling for a few days on this one issue. I am using nightmarejs to click an image on an Ebay product listing page. When clicked, the full-sized version of the image appears in a lightbox. Nightmarejs just won't click this image! I can click other links, but the image never gets clicked so no lightbox pops-up. This is the image I'm trying to click: URL: http://www.ebay.com/itm/Newton-Distance-S-III-Lime-Red-Running-Shoes-Mens-M-New-155/311559183260?hash=item488a5fdb9c&_trkparms

Cron and nightmarejs

筅森魡賤 提交于 2019-12-23 03:46:11
问题 I can't manage to run my cron with nightmarejs. The first iteration of the function get_data() works great but after that the cron restarts and the function will not be triggered again. Also "crawl ended" is never logged. Do you know what's wrong with my code? Logs 1 cron data fetched 2 cron 3 cron - var Nightmare = require('nightmare') var nightmare = Nightmare({ typeInterval: 300, show: true, executionTimeout: 120000, gotoTimeout: 120000 }); let data = "" - var get_data = function(){ return

what are those triple dot inside the array? marked it with a comment [duplicate]

不羁岁月 提交于 2019-12-20 07:48:37
问题 This question already has answers here : Spread Syntax ES6 (4 answers) Closed 10 months ago . I was learning how to web scrap in nodejs and came across this kind of array. What is the meaning? articles = [ //WHAT IS THIS ...articles, ...new_articles ]; 回答1: When we see three dots (…) in the code, it's either rest parameters or the spread operator. Rest parameters : When three dots (…) is at the end of function parameters it will gather the rest of the list of arguments into an array. spread

Cannot understand how to open a simple TWA inside an app (using AndroidX)

狂风中的少年 提交于 2019-12-18 09:52:20
问题 I am trying to open a TWA inside my app and have researched for 2 days. I've already managed to create a single TWA app, no fuss, just edit the manifest and a few things more. Now I need to have my own app - let's say the app has a splash screen activity at first which then opens the TWA inside the app. Can I launch a TWA inside my app through a simple splash screen activity, for example? I did try to use CustomTabs way, but it says it is deprecated and to use TrustedWebActivityIntentBuilder

Cannot understand how to open a simple TWA inside an app (using AndroidX)

拟墨画扇 提交于 2019-12-18 09:52:12
问题 I am trying to open a TWA inside my app and have researched for 2 days. I've already managed to create a single TWA app, no fuss, just edit the manifest and a few things more. Now I need to have my own app - let's say the app has a splash screen activity at first which then opens the TWA inside the app. Can I launch a TWA inside my app through a simple splash screen activity, for example? I did try to use CustomTabs way, but it says it is deprecated and to use TrustedWebActivityIntentBuilder

Repeatedly clicking an element on a page using Electron (NightareJS)

陌路散爱 提交于 2019-12-12 06:24:06
问题 I'm writing a page scraper for a dynamic web page. The page has an initial load and then loads the remainder of the content after a short load time. I've accounted for the load and have successfully scraped the HTML from the page, but the page doesn't load ALL the content at once. Instead it loads a specified amount of content via GET request URL and then has a "Get more" button on the page. My objective is to click this "Get More" button until all the content is loaded on the page. For those

nightmare js: get json response from POST request

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 04:57:06
问题 I am using nightmare to login to a page and click a few links. Then I go to a specific url for which a POST request is made. I want to retrieve the json response from the POST request. So far, I have this var Nightmare = require('nightmare'); const nightmare = Nightmare({ show: true }); nightmare .goto('https://my.url/') .type('#user_id', 'myUserId') .type('#password', 'passw0rd') .click('#button-login') .wait(3000) .goto('specific-url') // this URL loads a page with some data .end() .then

NodeJS - Communicating with a server that is attempting ntlm authentication, but encountering strange behavior

*爱你&永不变心* 提交于 2019-12-11 17:26:48
问题 I am attempting to write code that will allow my nodeJS server to scrape another website that is attempting to run ntlm authentication. When I arrive on the page a popup appears, into which I am supposed to enter credentials to access the site. However, that popup does not appear to be a part of chrome but a part of the OS; No matter what I try I can't find it in the elements of the page, which makes me think it is a part of the OS. (I am running Windows 10 on my development machine, but the