chromeless
chromeless copied to clipboard
How to accept a confirm box?
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
This seems definitely like a case that needs investigation. Would you even consider creating a PR for this?
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.
How about using evaluate to overwrite window.confirm
temporarily?
chromeless.evaluate(() => window.confirm = () => true)