Added waitForDialogToOpen as requested by issue-369