Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
tushar_swarnkar Absent Member.
Absent Member.
231 views

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.

 

Tried:

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

 

browser IE11

silk4j

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Closing dialog box of stale sessions

If you use the Locator Spy against one of the stale session, are you able to identify the blocking dialog?

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());

-Robert
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.