Confirm popups are not showing in Screenshot / are not working #3899

ihatecodinglikeking opened this Issue Jan 8, 2017 · 4 comments


None yet

2 participants

ihatecodinglikeking commented Jan 8, 2017 edited

What are you trying to achieve?

I have Delete Button in Bootstrap Modal,
If user clicks Delete its asks for Confirmation popup if "OK" call AJAX method.
IN Test cases after clicking the delete button JQuery is Not showing in Screenshots also,
I tried with removing Confirm it works fine but If I have Confirm is not working
here is my code

$('#modal_id .modal-footer .delete').on('click', function () {
                     var res = confirm("Are you sure you want to delete this?");
                     if(res == true) {
                            url:  'url',
                            type: 'POST',
                            data: {
                            success: function(r) {
                                var mJSON = JSON.parse(r);
                                if (mJSON.hasOwnProperty("reload")) {
                                } else if (mJSON.hasOwnProperty("alert")) {
                                    if (mJSON.alert.type == "error") {
                            error: function(e) {
                                // error
                     } else {
                         return false;

My test case
$I->click($modal.' .modal-footer .delete'); $I->wait(5); $I->makeScreenshot('1'); $I->executeJS("window.confirm = function(msg){return true;};"); $I->wait(5); $I->makeScreenshot('2');

After Delete Click I am waiting for some time and making Screenshot but there is no confirm in screenshot "1" and as well as nothing in "2"

versions : PhantomJS v2.1.1
Codeception 2.2.7
PHP 7.1.0

edno commented Jan 8, 2017 edited

Confirmation windows and other alerts are not displayed when using Webdriver, see documentation.


Oh then how to check like its working or not ? after making 2nd screenshot I have $I->waitForJS("return document.getElementById('toastr_success') != null");
If i remove confirm its passing,
If I have Confirm its failing due to Time out something


when I tried to use $I->acceptPopup();
its giving WebDriver: PhantomJS does not support working with popups

edno commented Jan 8, 2017

Have a look at #1372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment