Closed toranb closed 11 years ago
Also inside the waitForSelector block how can I get to the dom to lookup attributes / other elements on body?
I wait for an element with specific ID- #content for example. Element #content is generated by JS, so I won't get the callback until my JS app is all loaded. You can run page.evaluate(function(){ return x;}, function(x){ //do stuff with returned x here}) to run any javascript on the page.
I could wait for an element as you mentioned but what is the syntax to wait for a div with a specific class? such as
div class="jasmine_reporter"
Also can I do the page.evaulate (as you showed) inside the page.open block or instead of it or ?
Here is what I have currently
(function() {
var app = require('./app.js');
app.webserver.listen(8091);
var phantomProxy = require('phantom-proxy').create({}, function(proxy) {
var page = proxy.page;
phantom = proxy.phantom;
page.open("http://localhost:8091", function() {
page.waitForSelector('.jasmine_reporter', function(result) {
page.evaluate(function(){ return x;}, function(x){
console.log(x);
});
phantomProxy.end();
});
});
});
}).call(this)
Currently the part that says "app.webserver.listen(8091);"
is where I spin up a node based express website hosting just an index.html page (that I can see is working when I pause the process)
Yet I get a 404 -could the internal webserver phantom-proxy is using interrupt this in some way?
Thank you
closing this -no response (upgraded to node-phantom instead)
I'm loading up some javascript in the page phantom-proxy is opening and I'm not sure how to "waitFor" all the js to be loaded