simplified casperjs code