Thanks Blair for trying this manually. I was trying with test and getting weird 'webdriverException'.

I spent some more time and looks like its a timing issue.. I added a sleep and return statement and now it works fine.