public UITestControl GetActiveTab() { Playback.Wait(500); StudioWindow.WaitForControlEnabled(); var tabMgr = new UIUI_TabManager(StudioWindow); var idx = tabMgr.SelectedIndex; // to do remove below once performance is sorted! if (idx == -1) { idx = tabMgr.SelectedIndex; if (idx == -1) { return(null); } } if (idx >= tabMgr.Tabs.Count) { Playback.Wait(10000); } return(_tabManager.Tabs[_tabManager.SelectedIndex]); }