-1

I've just been starting to experiment with CasperJS for some testing purposes, but I'm apparently pretty crappy at it because I've isolated my code down to the very first task,:

"use strict";
var casper = require('casper').create({
    verbose: true,
    logLevel: 'debug'
    waitTimeout: 10000
});
phantom.cookiesEnabled = true;

casper.start('http://foobar.com', function afterstart() {
    if (this.exists('.logo-link')) {
        this.echo('BOOYA! Page is loaded', 'INFO');
    } else {
        this.echo('Page didnt load, something went all screwy.', 'ERROR');
    }
});

casper.run();

run it through a linter, made the appropriate changes, and I still get this error:

Test file: Test.js                                                              
FAIL SyntaxError: Parse error
#    type: uncaughtError
#    error: "SyntaxError: Parse error"
SyntaxError: Parse error                                                        
FAIL 1 tests executed in 0.103s, 0 passed, 1 failed.                            

Details for the 1 failed test:

In Test.js:0
uncaughtError: SyntaxError: Parse error

I've looked up some possible explanations, I added the phantom.cookiesEnabled = true, but I simply can't figure it out.

yungblud
  • 388
  • 4
  • 17

2 Answers2

2

Two best answers taken from similar question getting more information from phantomjs "SyntaxError: Parse error" message are:

1) run it with node:

node Test.js

2) use online syntax checker like http://esprima.org/demo/validate.html

Community
  • 1
  • 1
Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
1

You're missing a comma:

logLevel: 'debug' <--- Right here
waitTimeout: 10000
Blender
  • 289,723
  • 53
  • 439
  • 496
  • @user2493965: Explain what your error message is saying. I'm not too good with psychic debugging. – Blender Jul 11 '13 at 04:59