I am trying to automate electron application with playwright and struck at a point where I need to save or open a file. I am not able to get hold of the dialog that is being opened after I trigger save or open file menu Item.
I tried using both below events but none of them seems to work.
electronApp.waitForEvent('window')
window.waitForEvent('filechooser')
Is there any way of getting hold of the opened save dialog so that I can access the save button and complete the save functionality through e2e script.
You can't. As a workaround, you can mock the file saver window.
Example:
Above I mocked the
dialog.showSaveDialogto save a SVG file.appis fromawait _electron.launch(...),pageis fromawait app.firstWindow();There will be no file saver window popup. But your app can get the
filePathdirectly through the mock.