Esempio n. 1
0
 public static void GoToFrame(BrowserPageFrame frame)
 {
     lock (lockObject)
     {
         List <BrowserPageFrame> frameStack = new List <BrowserPageFrame>();
         GoToFrame(frame, ref frameStack);
     }
 }
        public SwitchToPopupView(BrowserPageFrame currentFrame, SwdMainView parent)
        {
            InitializeComponent();

            this.parentView = parent;
            this.presenter = MyPresenters.SwitchToPopupPresenter;

            presenter.InitWithView(this);
            presenter.InitWithFrame(currentFrame);
        }
        public int[] GetPath()
        {
            List <int>       path         = new List <int>();
            BrowserPageFrame currentFrame = this;

            while (currentFrame != null)
            {
                path.Add(currentFrame.Index);
                currentFrame = currentFrame.ParentFrame;
            }
            path.Reverse();
            return(path.ToArray());
        }
Esempio n. 4
0
        public static List <BrowserPageFrame> GetPageFramesTree(BrowserPageFrame parent)
        {
            lock (lockObject)
            {
                List <BrowserPageFrame> children = new List <BrowserPageFrame>();

                //
                var driver = SwdBrowser.GetDriver();

                var allFramesOnThePage = GetAllFrameElements();
                for (var i = 0; i < allFramesOnThePage.Length; i++)
                {
                    var frameElement = allFramesOnThePage[i];

                    BrowserPageFrame frameItem = new BrowserPageFrame()
                    {
                        ChildFrames     = null,
                        Index           = i,
                        LocatorNameOrId = null,
                        ParentFrame     = parent,
                    };

                    string elementId   = frameElement.GetAttribute("id");
                    string elementName = frameElement.GetAttribute("name");

                    if (!String.IsNullOrEmpty(elementName))
                    {
                        frameItem.LocatorNameOrId = elementName;
                    }
                    else if (!String.IsNullOrEmpty(elementId))
                    {
                        frameItem.LocatorNameOrId = elementId;
                    }
                    else
                    {
                        frameItem.LocatorNameOrId = String.Empty;
                    }

                    GetDriver().SwitchTo().Frame(i);
                    frameItem.ChildFrames = GetPageFramesTree(frameItem);

                    List <BrowserPageFrame> frameStack = new List <BrowserPageFrame>();
                    SwdBrowser.GoToFrame(parent, ref frameStack);

                    children.Add(frameItem);
                }

                return(children);
            }
        }
Esempio n. 5
0
 private static void GoToFrame(BrowserPageFrame frame, ref List <BrowserPageFrame> frameStack)
 {
     if (frame.ParentFrame == null)
     {
         SwdBrowser.GetDriver().SwitchTo().DefaultContent();
         frameStack.Reverse();
         foreach (var frameItem in frameStack)
         {
             SwdBrowser.GetDriver().SwitchTo().Frame(frameItem.Index);
         }
         return;
     }
     else
     {
         frameStack.Add(frame);
         GoToFrame(frame.ParentFrame, ref frameStack);
     }
 }
Esempio n. 6
0
        public static BrowserPageFrame GetPageFramesTree()
        {
            lock (lockObject)
            {
                BrowserPageFrame root = new BrowserPageFrame()
                {
                    ChildFrames     = null,
                    Index           = -1,
                    LocatorNameOrId = "DefaultContent",
                    ParentFrame     = null,
                };

                GetDriver().SwitchTo().DefaultContent();
                root.ChildFrames = GetPageFramesTree(root);

                return(root);
            }
        }
        internal void UpdatePageFramesList(BrowserPageFrame[] currentPageFrames)
        {
            ddlFrames.DoInvokeAction(() =>
            {
                ddlFrames.Items.Clear();
                ddlFrames.Items.AddRange(currentPageFrames);

                ddlFrames.SelectedItem = currentPageFrames.First();
            });

        }
Esempio n. 8
0
 private static void GoToFrame(BrowserPageFrame frame, ref List<BrowserPageFrame> frameStack)
 {
     if (frame.ParentFrame == null)
     {
         SwdBrowser.GetDriver().SwitchTo().DefaultContent();
         frameStack.Reverse();
         foreach (var frameItem in frameStack)
         {
             SwdBrowser.GetDriver().SwitchTo().Frame(frameItem.Index);
         }
         return;
     }
     else
     {
         frameStack.Add(frame);
         GoToFrame(frame.ParentFrame, ref frameStack);
     }
 }
Esempio n. 9
0
 public static void GoToFrame(BrowserPageFrame frame)
 {
     lock (lockObject)
     {
         List<BrowserPageFrame> frameStack = new List<BrowserPageFrame>();
         GoToFrame(frame, ref frameStack);
     }
 }
Esempio n. 10
0
        public static List<BrowserPageFrame> GetPageFramesTree(BrowserPageFrame parent)
        {
            lock (lockObject)
            {
                List<BrowserPageFrame> children = new List<BrowserPageFrame>();

                //
                var driver = SwdBrowser.GetDriver();

                var allFramesOnThePage = GetAllFrameElements();
                for (var i = 0; i < allFramesOnThePage.Length; i++)
                {
                    var frameElement = allFramesOnThePage[i];

                    BrowserPageFrame frameItem = new BrowserPageFrame()
                    {
                        ChildFrames = null,
                        Index = i,
                        LocatorNameOrId = null,
                        ParentFrame = parent,
                    };

                    string elementId = frameElement.GetAttribute("id");
                    string elementName = frameElement.GetAttribute("name");

                    if (!String.IsNullOrEmpty(elementName))
                    {
                        frameItem.LocatorNameOrId = elementName;
                    }
                    else if (!String.IsNullOrEmpty(elementId))
                    {
                        frameItem.LocatorNameOrId = elementId;
                    }
                    else
                    {
                        frameItem.LocatorNameOrId = String.Empty;
                    }

                    GetDriver().SwitchTo().Frame(i);
                    frameItem.ChildFrames = GetPageFramesTree(frameItem);

                    List<BrowserPageFrame> frameStack = new List<BrowserPageFrame>();
                    SwdBrowser.GoToFrame(parent, ref frameStack);

                    children.Add(frameItem);
                }

                return children;
            }
        }
Esempio n. 11
0
        public static BrowserPageFrame GetPageFramesTree()
        {
            lock (lockObject)
            {
                BrowserPageFrame root = new BrowserPageFrame()
                {
                    ChildFrames = null,
                    Index = -1,
                    LocatorNameOrId = "DefaultContent",
                    ParentFrame = null,
                };

                GetDriver().SwitchTo().DefaultContent();
                root.ChildFrames = GetPageFramesTree(root);

                return root;
            }
        }
 internal void SwitchToFrame(BrowserPageFrame frame)
 {
     PauseWebElementExplorerProcessing();
     try
     {
         SwdBrowser.DestroyVisualSearch();
         SwdBrowser.GoToFrame(frame);
         MyLog.Write("FRAME: Switched to frame with Index= " + frame.Index + "; and Full Name:" + frame.ToString());
     }
     finally
     {
         ResumeWebElementExplorerProcessing();
     }
 }
 internal void OpenSwitchToFrameCodeHelperPopup(BrowserPageFrame currentFrame)
 {
     SwitchToPopupView popupForm = new SwitchToPopupView(currentFrame, view);
     popupForm.ShowDialog();
 }