baudehlo / node-phantom-simple

Simple bridge to phantomjs for Node
MIT License
201 stars 70 forks source link

pass both "path" and "parameters" to create #136

Closed openrijal closed 8 years ago

openrijal commented 8 years ago

hi.

I would like to pass both the options i.e. "path" and "parameters" to the create method. I tried a lot of combinations, but nothing seems to work.

driver.create({path: require('slimerjs').path}, function (err, browser) {
        return browser.createPage(function (err, page) {
            return page.open(_url, function (err,status) {
                console.log(status);
                });
        });
    });

I tried sending options as array: [{path: ...}, {parameters: ...}] also as objects: {path: ...., parameters: ....}, but I'm not able to pass it properly.

I want slimerjs in the path, and ['--ignore-ssl-errors=yes', '--ssl-protocol=any'] in the parameters.

Please guide the correct way to achieve it.

Reewr commented 8 years ago

Have you tried the following structure?

var options = {
  path: require('slimerjs').path,
  parameters: {
    'ignore-ssl-errors': 'yes',
    'ssl-protocol': 'any'
  }
};

driver.create(options, fn....)
openrijal commented 8 years ago

yes, I tried that, using the above pattern gives me a "Null" driver.

danielcha commented 8 years ago

Having the same problem. Anyone figured this out?

openrijal commented 8 years ago

I have a working code sample here: https://github.com/crackjack/slimer-server/blob/master/slimer_server.js

Please check the commented section.