I am trying to use PhantomJS on a page with basic always auth, for example, this page
http://alexturpin.net/auth (test:rosebud)
Using the following
This is a closure issue, try to put your console.log in a callback
With that syntax you are wiping out the settings object, replacing it with only userName and password. Use that code to set them:
page.settings.userName = "test";
page.settings.password = "rosebud";
Probably PhantomJS should handle that better, i.e. not rely on the settings object for defaults.