johntitus / node-horseman

Run PhantomJS from Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call to .open() fails without an error

emarthinsen opened this issue · comments

Hi. I'm calling .open() to load a web page and about 50% of the time it fails without throwing an error. The promise chain just stops. Here's an example of the output I get from my app:

⨂ src (master)$: DEBUG='horseman*' BLUEBIRD_DEBUG=1 node local.js
  horseman using PhantomJS from $PATH +0ms
  horseman .setup() creating phantom instance 1 +237ms
  horseman .viewport() set 1440 undefined +12ms
  horseman phantom created +951ms
  horseman phantom version 2.1.1 +14ms
  horseman page created +9ms
  horseman phantomjs onLoadFinished triggered success NaN +8ms
  horseman .userAgent() set Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 +13ms
Trying to open the Google page
  horseman .open() https://www.google.com/ +0ms
⨂ src (master)$:

And here's a copy of part of the code:

    horseman
      .setDefaults()

      .log('Trying to open the Google page')

      .open(GOOGLE_PAGE)
      .url()
      .then(url => { console.log(`URL: ${url}`); })

My chain of calls goes on for a bit after that and ultimately ends with a catch block. It never gets called.

Does anyone know why loading the page might be failing without an error? It's fine if it fails, I just need to be able to detect it and retry.