Answer the question
In order to leave comments, you need to log in
Why isn't phantom working?
var phantom = require('phantom');
var express = require('express');
var config = require('./config/conf.js');
var http = require('http');
var app = express();
//var page = phantom.create();
var server = http.createServer(app);
app.get('/page', function (req, res) {
phantom.create().then(function (ph) {
ph.createPage().then(function (page) {
page.open('http://dev.myco.network').then(function (status) {
console.log(status);
page.injectJs('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', function() {
console.log($('body').html());
res.json({'pageStatus': status});
ph.exit();
});
});
});
});
});
server.listen(config.port, function() {
console.log('Server listening on port ' + config.port);
});
page.injectJs('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', function() {
console.log($('body').html());
res.json({'pageStatus': status});
ph.exit();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question