lapwinglabs / x-ray-phantom

phantom driver for x-ray.
112 stars 30 forks source link

Passing dnodeOpts to disable the weak module #15

Open ghost opened 8 years ago

ghost commented 8 years ago

im trying to disable the weak module with the following

var phantom = require('x-ray-phantom');
var x = require('x-ray')();

var options = {
    dnodeOpts: {
        weak: false
    }
};

x.driver(phantom(options));

I keep getting an

Error: Cannot find module 'weak'

I'm going to assume I'm passing the option incorrectly?

asarosi commented 8 years ago

Hello guys,

I'm facing the same issue, could somebody give us some advice?

ghostfreak3000 commented 8 years ago

Faced the same problem.

Mine was a node-gyp issue on windows 10 so it was failing to build the weak package on npm install.

Switched to Linux and it all worked like a charm

gustavotroisgarcia commented 8 years ago

Hello, the following options works for me on Windows 10.

var Xray = require('x-ray');
var x = Xray().driver(phantom({webSecurity: false, weak: false}));

x-ray-phantom calls Nightmare constructor that has default options, and weak is one of them.

function driver(options, fn) {
  if ('function' == typeof options) fn = options, options = {};
  options = options || {};
  fn = fn || phantom;
  var nightmare = new Nightmare(options);
/**
 * Default options.
 *
 * http://phantomjs.org/api/command-line.html
 */

var DEFAULTS = {
  timeout: 5000,
  interval: 50,
  weak: true,
  loadImages: true,
  ignoreSslErrors: true,
  sslProtocol: 'any',
  proxy: null,
  proxyType: null,
  proxyAuth: null,
  cookiesFile: null,
  webSecurity: true
};
MichaelTSS commented 8 years ago

@gustavotroisgarcia Thanks ! This solved my issue