Monday, 15 May 2017

Horseman.js -> handling window.confirm

I need help with a problem I'm facing, and am sure node-horseman can handle it.

I'm trying to accept a "window.confirm" alert and tried many things without success. Basically, after clicking on a button, I want to be able to "accept" the confirm message using horseman.

Going through the docs, I found this:

.at(event, callback) Respond to page events with the callback.

.at('confirm', function(msg) {
    return msg === 'Like this?' ? true : false;
})

Nevertheless, when I put the .at like this, before any .open

horseman
    .at('confirm', function(msg) {
        return msg === 'Do you accept?' ? true : false;
    })

I get an error saying:

TypeError: horseman.at is not a function

What I'm looking for: a way to accept a window.confirm using node-horseman.

Any help will be really appreciated!



via learn2day

No comments:

Post a Comment