Esempio n. 1
0
        /// <summary>
        /// VerifyMyMetricsPageWorks
        /// </summary>
        public void VerifyMyMetricsPageWorks()
        {
            #region Variable Declarations
            HtmlDiv       uICatchAllPane = this.UIMSNcomHotmailOutlookWindow.UIMSNcomHotmailOutlookDocument.UIEbAd32190459_billboaFrame.UIHTML5Billboard88x31tDocument.UICatchAllPane;
            HtmlIFrame    uIEbAd32190459_billboaFrame = this.UIMSNcomHotmailOutlookWindow.UIMSNcomHotmailOutlookDocument.UIEbAd32190459_billboaFrame;
            HtmlHyperlink uIMyMetricsHyperlink        = this.UIMSNcomHotmailOutlookWindow.UIMercuryHealthGroupMeDocument.UIMyMetricsHyperlink;
            #endregion

            // Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
            Playback.PlaybackSettings.ContinueOnError = true;

            // Mouse hover 'catchAll' pane at (1, 1)
            Mouse.Hover(uICatchAllPane, new Point(1, 1));

            // Mouse hover 'ebAd32190459_billboard_iframe_32190459_93048926593...' frame at (1, 1)
            Mouse.Hover(uIEbAd32190459_billboaFrame, new Point(1, 1));

            // Failed to record the object corresponding to this action.

            // Reset flag to ensure that play back stops if there is an error.
            Playback.PlaybackSettings.ContinueOnError = false;

            // Click 'My Metrics' link
            Mouse.Click(uIMyMetricsHyperlink, new Point(72, 39));
        }
Esempio n. 2
0
        public void HtmlInputButton_ClickInCUITeIFrame_Succeeds()
        {
            var        bWin   = BrowserWindow.Launch(currentDirectory + "/iframe_test.html");
            HtmlIFrame iFrame = bWin.Find <HtmlIFrame>();

            iFrame.Find <HtmlInputButton>(By.ValueAttribute("Log In")).Click();
            bWin.Close();
        }
        private void DoSelectFrame(ObjectLocator locator)
        {
            //IWebDriver driver = Driver;
            string objectId = locator.ActualLocator;
            string objectIdValue = objectId.ToLower(CultureInfo.CurrentCulture).Trim();
            int counter = retry;
            int frameIndex = -1;
            UITestControl element = FindCodedUIElement(objectId);
            string paradigm = element.TechnologyName;

            while (counter > 0)
            {
                try
                {
                    counter--;

                    if (paradigm.Equals("Web", StringComparison.OrdinalIgnoreCase))
                    {
                        HtmlIFrame frame = new HtmlIFrame(qWin);
                        if (objectIdValue.StartsWith("index="))
                        {
                            frameIndex = int.Parse(objectId.Substring(objectId.IndexOf("=") + 1, objectId.Length).Trim());
                            frame.SetProperty(HtmlIFrame.PropertyNames.TagInstance, frameIndex);
                            frame.SetFocus();
                        }
                        else if ("parent".Equals(objectIdValue, StringComparison.OrdinalIgnoreCase) || ("null".Equals(objectIdValue, StringComparison.OrdinalIgnoreCase)))
                        {
                            //frame.
                        }
                        else
                        {
                            //check for new windows method should implement

                        }

                    }

                    /*
                    ITargetLocator target;
                    if (objectIdValue.StartsWith("index="))
                    {
                        //Should use extensions class substring
                        frameIndex = int.Parse(objectId.Substring(objectId.IndexOf("=") + 1, objectId.Length).Trim());

                        target = driver.SwitchTo();
                        target.DefaultContent();
                        target.Frame(frameIndex);
                    }
                    else if ("parent".Equals(objectIdValue, StringComparison.OrdinalIgnoreCase) || ("null".Equals(objectIdValue, StringComparison.OrdinalIgnoreCase)))
                    {
                        target = driver.SwitchTo();
                        target.DefaultContent();
                    }
                    else
                    {
                        //check for new windows method should implement
                        IWebElement element = FindWebElement(objectId);
                        target = driver.SwitchTo();
                        target.Frame(element);

                    }*/
                    reportResults("Select Frame", "Select Frame command passed. Object " + locator.LogicalName, LogLevel.Success);
                    break;
                }
                catch (Exception e)
                {
                    sleep(retryInterval);
                    if (!(counter > 0))
                    {
                        log.Error(e);
                        if (e.GetType().Equals(typeof(TimeoutException)))
                        {
                            reportResults(true, "Select Frame", "Select Frame command failed. Object " + locator.LogicalName + " cannot be found in the webpage. Actual Error :  " + e.Message, LogLevel.Error, e.StackTrace);
                        }
                        else
                        {
                            reportResults(true, "Select Frame", "Select Frame command cannot access. Object  " + locator.LogicalName + ". Actual Error :  " + e.Message, LogLevel.Error, e.StackTrace);
                        }
                    }
                }
            }
        }