ClosingBrowser
Posted: Mon Apr 15, 2013 7:03 pm
I am trying to close all open browser or form ,but the problem it closed down the Ranorex Studio also
Thank you
Code: Select all
public static int CloseBrowser()
{
for (int i = 0; i < 10; i++)
{
Ranorex.Button button=null;
bool found = Host.Local.TryFindSingle<Ranorex.Button>("/form[@title~'.*Windows Internet Explorer']/titlebar[@accessiblerole='TitleBar']/button[@text='Close']", 2000, out button);
if(found)
{
button.MoveTo();
button.DoubleClick();
}
if (i == 2)
break;
}//for loop
return 0;
}