private void CheckFrames(IWebDriver driver)
            {
                // Setup our retry options first.
                var options = new BrowserCommandOptions
                {
                    RetryAttempts   = 1,
                    ExceptionTypes  = { typeof(StaleElementReferenceException), typeof(NoSuchFrameException) },
                    ExceptionAction = null
                };
                var command = new DelegateBrowserCommand <bool>(options, d =>
                {
                    var iframes = GetFrameElements(d);

                    foreach (IWebElement frame in iframes)
                    {
                        var currentFrameId = frame.GetAttribute("id");

                        driver.WaitUntilAvailable(By.Id(currentFrameId));
                        d.SwitchTo().Frame(currentFrameId);
                        InjectRecordingScript();
                        //CheckFrames(driver); //Child Frames
                    }

                    return(true);
                });

                command.Execute(driver);
            }
        public BrowserCommandResult <TResult> Execute <TResult>(DelegateBrowserCommand <TResult> @delegate)
        {
            Browser.Depth++;
            var command = @delegate.Execute(Browser.Driver);

            Browser.CalculateResults(command);
            Browser.Depth--;
            return(command);
        }
        public BrowserCommandResult <TResult> Execute <TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(BrowserCommandOptions options, Func <IWebDriver, T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> @delegate, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9)
        {
            Browser.Depth++;
            var command = new DelegateBrowserCommand <T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(options, @delegate).Execute(Browser.Driver, p1, p2, p3, p4, p5, p6, p7, p8, p9);

            Browser.CalculateResults(command);
            Browser.Depth--;

            return(command);
        }
        public BrowserCommandResult <TResult> Execute <TResult, T1, T2, T3, T4>(BrowserCommandOptions options, Func <IWebDriver, T1, T2, T3, T4, TResult> @delegate, T1 p1, T2 p2, T3 p3, T4 p4)
        {
            Browser.Depth++;
            var command = new DelegateBrowserCommand <T1, T2, T3, T4, TResult>(options, @delegate).Execute(Browser.Driver, p1, p2, p3, p4);

            Browser.CalculateResults(command);
            Browser.Depth--;

            return(command);
        }
        public BrowserCommandResult <TResult> Execute <TResult, T1, T2, T3>(string commandName, Func <IWebDriver, T1, T2, T3, TResult> @delegate, T1 p1, T2 p2, T3 p3)
        {
            Browser.Depth++;
            var command = new DelegateBrowserCommand <T1, T2, T3, TResult>(new BrowserCommandOptions(Constants.DefaultTraceSource, commandName), @delegate)
                          .Execute(Browser.Driver, p1, p2, p3);

            Browser.CalculateResults(command);
            Browser.Depth--;

            return(command);
        }
        public BrowserCommandResult <TResult> Execute <TResult>(BrowserCommandOptions options, Func <IWebDriver, TResult> @delegate)
        {
            Browser.Depth++;
            var command = new DelegateBrowserCommand <TResult>(options, @delegate).Execute(Browser.Driver);

            Browser.Depth--;
            Browser.CalculateResults(command);


            return(command);
        }
        public BrowserCommandResult <TResult> Execute <TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string commandName, Func <IWebDriver, T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> @delegate, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9)
        {
            Browser.Depth++;
            var command = new DelegateBrowserCommand <T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(new BrowserCommandOptions(Constants.DefaultTraceSource, commandName), @delegate)
                          .Execute(Browser.Driver, p1, p2, p3, p4, p5, p6, p7, p8, p9);

            Browser.CalculateResults(command);
            Browser.Depth--;

            return(command);
        }
            private void SwitchToContentFrame(IWebDriver driver)
            {
                var options = new BrowserCommandOptions
                {
                    RetryAttempts   = 1,
                    ExceptionTypes  = { typeof(StaleElementReferenceException), typeof(NoSuchFrameException) },
                    ExceptionAction = null
                };
                var command = new DelegateBrowserCommand <bool>(options, d =>
                {
                    //wait for the content panel to render
                    driver.WaitUntilAvailable(By.Id("crmContentPanel"));

                    //find the crmContentPanel and find out what the current content frame ID is - then navigate to the current content frame
                    var currentContentFrame = driver.FindElement(By.Id("crmContentPanel")).GetAttribute("currentcontentid");

                    driver.SwitchTo().Frame(currentContentFrame);

                    return(true);
                });
            }