Added sleepFirst parameter in waitForDialogToOpen()