PhantomJS returns no real results.
Hello, I did a very small test:
var page = require('webpage').create()
, fs = require('fs');
page.open("http://www.google.it/search?q=web+design", function(status){
if (status === 'success')
{
page.render('google.png');
fs.write("source.html", page.content, 'w');
}
phantom.exit();
})
As you can see I search "web design" on google.it
Now, looking the source.html I noticed differences between PhantomJS generated source code and the real (Element Inspector of Chrome) html.
In my source code a result has this code:
`
WebDesign - Guide e approfondimenti per webdesigner - HTML.it
i consigli di esperti designer in guide e articoli di approfondimento in italiano.
BUT the real source (read via Element Inspect of Chrome) is:
`
WebDesign - Guide e approfondimenti per webdesigner - HTML.it
Why those results have different code?
I read PhantomJS executes all the JS Inside the page as I browser does, so why those differences?
Not a bug. Please search the mailing list, this has been answered many times before: (1) you need to wait for the JS to execute, and (2) some sites serve different data depending on the browser requesting it, so change the userAgent string if you care about that.