Question
standard chartered global business services
IN
Last activity: 5 Feb 2019 0:23 EST
Close New Opened TAB in Internet Explorer 11
Hi,
we can close the new Opened tab via C# script.
add COM reference -- >Microsoft Internet Controls
using SHDocVw;
ShellWindows _shellWindows = new SHDocVw.ShellWindows();
string processType;
foreach (InternetExplorer ie in _shellWindows)
{
//this parses the name of the process
processType = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
//this could also be used for IE windows with processType of "iexplore"
if (processType.Equals("iexplore") && ie.LocationURL.Contains(@"identity")) // PASS the url contains instead of "identity"
{
ie.Quit();
}
}
orelse
we can use the Close Window method and we need to interrogate the "Close Current Tab" or "Close All Tab" option to continue further.