Level 1
$browser->dismissDialog() = press Cancel (if confirmation)
$browser->acceptDialog() = press OK
$browser->assertDialogOpened('Text in dialog'); = check dialog exist with text specified.
4 likes
I created a browser test with Dusk to test functionality of links on a page. One of the links has onclick event that create confirm dialog. The test simply raised UnexpectedAlertOpenException. How do I interact with the dialog such as cancel or click OK button on it?
I did tried to do switchTo as some discussion on SO suggested:
...
->clickLink("hapus")
->switchTo()
->alert()
->accept()
->aseertNotSee("Hello World")
It doesn't work.
Thanks
$browser->dismissDialog() = press Cancel (if confirmation)
$browser->acceptDialog() = press OK
$browser->assertDialogOpened('Text in dialog'); = check dialog exist with text specified.
Please or to participate in this conversation.