I can't seem to do a simple form submit.
Below is the code that I did to submit "Test" to the Google search form and print out the results.
var url = 'http://www.google.com/',
page = new WebPage();
page.open(url, function(status) {
if (status !== 'success')
{
console.log('Unable to access network');
phantom.exit();
return;
}
else
{
page.includeJs("//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js", function() {
page.evaluate(function() {
$('#gbqfq').val("Test");
$("#gbqfba").click();
});
page.render('google.png');
phantom.exit();
});
}
});
Anyone can show me how to do this? I have looked around here and in other sites but nothing seemed to work.