using waitForSelector instead of wait