So, I've been having a bit of issues using http://uername:[email protected] for http auth, and I also tried using headers and various other solutions for auth and none worked, except one solution that I found that works well is using JS to login, taken from another solution found here. (PhantomJS doesn't send authentication header). My question is how can I integrate YSlowJS, PhantomJs and the following script such that when I use I will get the reports returned to me.
$ phantomjs yslow.js myScript.js
//(this returns) FAIL to load undefined
//This is myScript.js
var page = require('webpage').create(),
system = require('system'),
t, address;
page.settings.userName = 'test';
page.settings.password = 'test';
address = "http://browserspy.dk/password-ok.php";
//using the url from the solution to the link above
page.open(address, function (status)
{
if (status !== 'success') {
console.log('FAIL to load the address');
}
else
{
console.log('Page title is ' + page.evaluate(function ()
{
return page.open(address);
//--> this returns FAIL to load undefined
//--> I take it "page" is the issue
}));
}
phantom.exit();
});
Im guessing that the issue is returning the correct variable, if so, what should it be?