Example #1
0
 /// <summary>
 /// To switch control from one browser from another browser
 /// </summary>
 /// <param name="browserObj"></param>
 /// <param name="pageTitle"></param>
 public void SwitchWindow(ISelenium browserObj, string pageTitle)
 {
     try
     {
         Thread.Sleep(2000);
         string[] windowTitles = browserObj.GetAllWindowTitles();
         for (int i = 0; i < windowTitles.Length; i++)
         {
             string strTemp = windowTitles[i].ToString();
             if (strTemp.Contains(pageTitle))
             {
                 // browser.WaitForPopUp(windowTitles[i], "30000");
                 browserObj.SelectWindow(windowTitles[i]);
                 Thread.Sleep(2000);
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'SwitchWindow' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }