internal static By GetBy(TOCChoice choices)
            {
                switch (choices.By)
                {
                case "Id":
                    return(By.Id(choices.Value));

                case "XPath":
                    return(By.XPath(choices.Value));

                case "CssSelector":
                    return(By.CssSelector(choices.Value));
                }
                return(null);
            }
            internal static void ExamineSearchResult(SearchResult result, List <TOCScreenshot> screenshotsSettings, string resultPrefix)
            {
                TOCScreenshot screenshotSettings = null;
                TOCChoice     choice             = null;

                try
                {
                    //step0: setup
                    CurrentDriver.Navigate().GoToUrl(result.ResultUrl);
                    LoadSite(result.ResultUrl, IDs.Redland.Buttons["Home.Search"]);
                    ConfirmReady();
                    //#0:Hide Show TOC if it is hidden
                    //ClickField(IDs.Redland.Buttons["Home.ToggleTOC"]);
                    //

                    for (int i = 0; i < screenshotsSettings.Count; i++)
                    {
                        ShowTOCIfNotVisible();
                        var prefix = $"{resultPrefix}screenshot {i + 1} of {screenshotsSettings.Count}: ";
                        currentStep = $"{prefix}Show TOC if hidden";
                        CallUpdateStatus(currentStep);

                        screenshotSettings = screenshotsSettings[i];
                        currentStep        = $"{prefix}{screenshotSettings.Filename}";
                        CallUpdateStatus(currentStep);
                        for (int j = 0; j < screenshotSettings.Choices.Count; j++)
                        {
                            //#0:skip a whole branch of the TOC if its root is no
                            choice = screenshotSettings.Choices[j];
                            if (string.IsNullOrWhiteSpace(choice.By) || string.IsNullOrWhiteSpace(choice.Value))
                            {
                                continue;
                            }

                            if (choice.ChoiceText == "Coastal Management District")
                            {
                                1.ToString();
                            }
                            var byObject = GetBy(choice);
                            if (byObject != null)
                            {
                                var text = choice.ChoiceText;
                                if (!string.IsNullOrWhiteSpace(choice.Ticked) && Convert.ToBoolean(choice.Ticked))
                                {
                                    //#0:Why is "Road Names" not clicked here?
                                    ClickFieldIfUnchecked(byObject);
                                    currentStep = $"{prefix}Click if unchecked: {text}";
                                    CallUpdateStatus(currentStep);
                                }
                                else
                                {
                                    //#0:Hangs on this for screenshot1: result 1 of 1: screenshot 1 of 2: Click if checked: Coastal Management District
                                    //#0:Why is "Lot Numbers" not clicked here?
                                    ClickFieldIfChecked(byObject);
                                    currentStep = $"{prefix}Click if checked: {text}";
                                    CallUpdateStatus(currentStep);
                                }
                            }
                        }
                        ClickField(IDs.Redland.Buttons["Home.ToggleTOC"]);
                        ConfirmReady();
                        currentStep = $"{prefix} Waiting for charts to load";
                        CallUpdateStatus(currentStep);
                        if (!ConfirmImagesLoaded())
                        {
                            throw new ApplicationException($"{currentStep} - Charts were not loaded. A timeout may have occured");
                        }

                        currentStep = $"{prefix} saving screenshot";
                        Thread.Sleep(Engine.Variables.TOCSlidingDelay);
                        CallUpdateStatus(currentStep);
                        var imagePath = Path.Combine(result.ResultFolder, screenshotSettings.Filename);
                        TakeScreenshot(imagePath);
                    }
                }
                catch (Exception x)
                {
                    if (screenshotSettings != null)
                    {
                        x.Data.Add(nameof(screenshotSettings), screenshotSettings.ToString());
                    }
                    if (choice != null)
                    {
                        x.Data.Add(nameof(choice), choice.ToString());
                    }
                    throw;
                }
            }