How might I extend this code to browse two web pages after logging, say first check the gmail as in the example you gave (below), process that, then scrape the calendar page? e.g. https://www.google.com/calendar/render?tab=mc
The Junjo async syntax looks wonderfully expressive, just trying to get the hang of it.
var userdata = {
email: "XXXXXX@gmail.com",
pass : "XXXXXXXX"
};
var $b = new browser();
$b.submit({
from : 'https://accounts.google.com/Login',
selector: "#gaia_loginform",
data : {
Email : userdata.email,
Passwd : userdata.pass
}
});
// authenticated access
$b.browse('https://mail.google.com/mail/u/0/?ui=html&zy=d')
.after(); // browse after previously registered function
/* running on end of all browsings
* err: error object or null
* out: { result : result body, ...}
*/
$b.on("end", function(err, out) {
console.log(out.url, out.result, out.responseHeaders);
});