I'm using Chrome as a browser and can't quite figure out how to dismiss a print dialog that appears on click of a particular button.
I have tried using browser.dismissAlert();
and browser.keys([browser.Keys.ESCAPE]);
to hit the escape button, and neither works. I'm not sure that Nightwatch is aware that there is a dialog at all.
I've been searching online and can't seem to find a solution... anyone got any ideas please?
So, as it turns out, Selenium cannot handle Chrome dialogs. I did however find a solution by reading this page and adding --disable-print-preview
to the chromeOptions in the nightwatch.json file in my project.
This dismissed the Chrome print dialog, but still brings up the Mac system dialog, and I don't think Selenium capabilities extends to system dialogs, so for the purpose of testing, I've just disabled the print functionality.
Shame I didn't find a better solution, but just wanted to update for those of you upvoting