chromeless icon indicating copy to clipboard operation
chromeless copied to clipboard

How to accept a confirm box?

Open queicherius opened this issue 6 years ago • 3 comments

I'm trying to accept a (browser-native) confirm box. My current try is as follows, but does not seem to do anything:

// Clicking the button to trigger the box. This is successful,
// the JS event triggers and window.confirm gets called
await chromeless.click('#button')

// No confirm box shown :(
await chromeless.screenshot()

// Still no confirm box shown :(
await chromeless.wait(1000)
await chromeless.screenshot()

// Trying to press enter?
await chromeless.press(13)

// Still no confirm box, and not accepted either, JS event did not trigger
await chromeless.screenshot()

Is there something I am missing here?


Edit: Chromium 59.0.3071.109 Built on Ubuntu, running on Ubuntu 16.04

queicherius avatar Jul 27 '17 21:07 queicherius

This seems definitely like a case that needs investigation. Would you even consider creating a PR for this?

schickling avatar Jul 27 '17 21:07 schickling

I would be up for putting some time in - we use confirm boxes fairly frequently - but I'd need some pointers on where to start.

queicherius avatar Aug 03 '17 16:08 queicherius

How about using evaluate to overwrite window.confirm temporarily?

chromeless.evaluate(() => window.confirm = () => true)

erikhuisman avatar Mar 12 '18 15:03 erikhuisman