I am using Selenium Webdriver in Node JS to do a Google search. When I set the browser as Firefox on my local machine, the Google results page renders as expected; it's the same as I see when I do the Google search as a human.
Now, I'm trying to do the same on my Heroku server. I can't seem to get Firefox on the server, so I'm using PhantomJS. It successfully does the Google search, but some data is missing from the page (I presume it is added later by Javascript).
How can I make the PhantomJS results page look the same as Firefox? Can I make PhantomJS appear to be Firefox?
var driver = new webdriver.Builder().forBrowser('phantomjs').build();
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('empire boston');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('empire boston - Google Search'), 10000);
driver.getTitle().then(function(title) {
console.log('Page title is: ' + title);
});
driver.getPageSource().then(function(html) {
console.log("HTML: " + html);
});