selenium - node.js - wd test cases

I am having a function for my test case, but that get called before the browser get loaded. how to do with that.

var browserWin='';

try{
    var browserWin=browser
        .chain()
        .init({
            browserName: 'firefox',
            tags: ["LoginTest"],
            name: "Login Test"
    }) .get(URL+'/main/login')
    .setAsyncScriptTimeout(100000,function(err){
       validatFields(browserWin);
   })

}
catch (err){
     console.error('........Exception..........'+err)
}

validatFields get called before the login page get loaded.

I tried in the following way, its coming correctly.

var browserWin='';

try{
    var browserWin=browser
        .chain()
        .init({
            browserName: 'firefox',
            tags: ["LoginTest"],
            name: "Login Test"
    }) .get(URL+'/main/login', function(){
       validatFields(browserWin);
   })

}
catch (err){
     console.error('........Exception..........'+err)
}