private int GetTabIndexToActivateByTitle(string titlePart)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(_hWnd), OBJID.OBJID_WINDOW, ref _accessible);

            CheckForAccessible();

            var index          = 0;
            var ieDirectUIHWND = new TabActivator(_hWnd);

            foreach (var accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (!string.IsNullOrEmpty(tab.Title))
                        {
                            if (tab.Title.ToLower().Contains(titlePart.ToLower()))
                            {
                                return(index);
                            }
                        }
                        index++;
                    }
                }
            }

            return(-1);
        }
        internal void ActivateTab(string by, string phrase)
        {
            TabSearchBy searchBy;

            if (Enum.TryParse(by.CapitalizeFirstLetter(), out searchBy) == false)
            {
                throw new ApplicationException("Argument 'by' is not correct");
            }

            int tabIndexToActivate = 0;

            switch (searchBy)
            {
            case TabSearchBy.Title:
                tabIndexToActivate = GetTabIndexToActivateByTitle(phrase);
                break;

            case TabSearchBy.Url:
                tabIndexToActivate = GetTabIndexToActivateByUrl(phrase);
                break;
            }

            AccessibleObjectFromWindow(GetDirectUIHWND(_hWnd), OBJID.OBJID_WINDOW, ref _accessible);

            CheckForAccessible();

            var index          = 0;
            var ieDirectUIHWND = new TabActivator(_hWnd);

            foreach (var accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (tabIndexToActivate >= child.ChildCount - 1)
                        {
                            return;
                        }

                        if (index == tabIndexToActivate)
                        {
                            tab.ActivateTab();
                            var activeIe = IEManager.launchedIE?.Where(ie => ie.Ie.hWnd == _hWnd).FirstOrDefault();
                            if (activeIe != null)
                            {
                                IEManager.SwitchIE(activeIe.Id);
                            }
                            return;
                        }

                        index++;
                    }
                }
            }
        }