Closing dialog box of stale sessions
I have a script which doesn't close browsers if the test fails. The reason identified was because of an open dialog box. This dialog box triggers a download action.
When I re-run the test, I would like to start fresh with all browsers closed and no open dialog boxes.
Any suggestion on the best way to ensure that all browsers get closed.
1. finding the dialog box again when the script is re-run and close it. --- doesn't work
2. tried sending the ALT+F4 keys. it still just closes the dialog box and triggers the download and doesn't close the browser. -- doesn't work
RE: Closing dialog box of stale sessions
If so, what locator is returned?
If you have a single application configuration for IE11, you could try something similar to the following to try and close any potential blocking dialogs or windows:
List<Dialog> dlgs = desktop.<Dialog>findAll("//Dialog");
List<Window> wnds = desktop.<Window>findAll("//Window");
List<BrowserApplication> bAs = desktop.<BrowserApplication>findAll("//BrowserApplication");
dlgs.stream().forEach(d -> d.closeSynchron());
wnds.stream().forEach(w -> w.closeSynchron());
bAs.stream().forEach(b -> b.closeSynchron());