jamesgpearce / confess

[ARCHIVED] Uses PhantomJS to headlessly analyze web pages and generate manifests. You may be able to use the puppeteer-har package instead.
874 stars 101 forks source link

TypeError: undefined is not an object (evaluating 'phantom.args.length') on PhantomJS 2.0.0 #9

Closed bbuchalter closed 6 years ago

bbuchalter commented 9 years ago
brianb@Brian-Air:~/workspace/confess(master)$ phantomjs confess.js http://www.google.com cssproperties
TypeError: undefined is not an object (evaluating 'phantom.args.length')

  confess.js:417
  :0 in forEach
  confess.js:416 in processArgs
  confess.js:6 in run
Come2Daddy commented 9 years ago

Can't go further right now, just what phantom's API doc saying.

Quick hack to get it working with PhantomJS 2.#

Add in top of file

var system = require('system');

And replace any occurences of

phantom.args

by

system.args

Finaly, because system.args isn't spliced

var a = 0;

becomes

var a = 1;
dominiquedutra commented 9 years ago

After Come2Daddy fix I just get:

"task" argument must be one of: performance, appcache, cssproperties

using

phantomjs confess.js http://google.com performance [Or appcache, or cssproperties]
Come2Daddy commented 9 years ago

Yo dawg, I heard you like fix, so I fixed my fix. xzibit approves

small-carbon commented 9 years ago

I also appears the question, how to solve

small-carbon commented 9 years ago

@Come2Daddy Can give a solution?

small-carbon commented 9 years ago

Thank you, ok

LaurentPerche commented 8 years ago

Is there a fix to this issue?

ahmadawais commented 8 years ago

Same issue here

TypeError: undefined is not an object (evaluating 'phantom.args.length')

  phantomjs://code/confess.js:417
  :0 in forEach
  phantomjs://code/confess.js:416 in processArgs
  phantomjs://code/confess.js:6 in run
alexanderlazaris commented 8 years ago

Just downloaded the package, had high hopes, let down by TypeError.

ashercoren commented 7 years ago

I get a similar error: undefined is not an object (evaluating 'phantom.args[0]')

ashishk29 commented 7 years ago

Hi,

Changes in confess.js file

Added line at top var system = require('system');

Replace phantom.args by system.args

run "phantomjs confess.js performance http://www.google.com" It's working for me.

leimbag commented 7 years ago

like @Come2Daddy say: Changes confess.js file 1.Add in top of file
var system = require('system'); 2.replace any occurences of phantom.args to system.args

  1. change a defined in "processArgs" function var a = 0; to var a = 1;

run phantomjs confess.js "https://www.google.com" performance

It's working for me.

hotbaby commented 7 years ago

@leimbag the answer fixed the issue.