User code for close all browsers not working for EDGE
Posted: Wed Sep 27, 2017 1:02 pm
Hello,
first, i´m not very in with coding oder development, so i have a user code from another project for closing all browser windows.
i tried to use it, it works for Firefox, IE and Chrome but not for the EDGE browser. I need a little assistance, what i have to change on this code to make it work also with EDGE.
Ranorex is Version 7.1.2 on Windows 10 with Microsoft Edge 38.14393.1066.0.
Thank you and regards
Alex
first, i´m not very in with coding oder development, so i have a user code from another project for closing all browser windows.
i tried to use it, it works for Firefox, IE and Chrome but not for the EDGE browser. I need a little assistance, what i have to change on this code to make it work also with EDGE.
Code: Select all
public void closeAllBrowserTabs(){
Report.Info("attempting to close open browser windows...");
IList<WebDocument> wdList = Host.Local.Find<WebDocument>("/dom");
Report.Info("open browser windows: "+wdList.Count);
foreach(WebDocument wd in wdList) {
wd.EnsureVisible();
if(wd.Visible) {
try {
wd.Close();
} catch(Ranorex.ActionFailedException e) {
Report.Warn("failed to close browser window/tab: "+e.Message);
}
}
}
Delay.Milliseconds(500);
}
Thank you and regards
Alex