wait better for page to be loaded by using process.nextTick