Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Dusk Javascript Confirm()

In my form, in order to submit, I need to press the OK button in a Javascript confirm() popup. How can I confirm in Laravel Dusk so that I can automate the submission of the form for testing purposes?

Image of the Confirm

like image 827
Jennifer Zhou Avatar asked Jun 16 '26 05:06

Jennifer Zhou


1 Answers

$browser->dismissDialog(); # = press Cancel (if confirmation)
$browser->acceptDialog(); # = press OK
$browser->assertDialogOpened('Text in dialog'); # = check dialog exist with text specified.

Good luck

like image 143
XXLIVE Avatar answered Jun 17 '26 18:06

XXLIVE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!