Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="document"></param>
        /// <param name="tv"></param>
        internal void CapturePage(HtmlDocument document, TreeView tv)
        {
            if (!initialized)
            {
                Initialize(document);
            }
            wxPage page = new wxPage();

            page.Name = document.Title;
            wxTsSimple test     = new wxTsSimple();
            wxTsSimple linkTest = new wxTsSimple();

            linkTest.Name = "Captured Links";
            test.Name     = "Captured Html Elements";
            TreeNode tnPage = new TreeNode(page.ToString());

            tnPage.Tag = page;
            TreeNode tnTest = new TreeNode(test.ToString());

            tnTest.Tag = test;
            TreeNode tnTestLnk = new TreeNode(linkTest.ToString());

            tnTestLnk.Tag = linkTest;
            foreach (HtmlElement element in document.All)
            {
                wxAction action = WxFactory.GetWxAction(element);
                if (action != null)
                {
                    TreeNode tnAction = new TreeNode(action.ToString());
                    tnAction.Tag = action;
                    if (action is wxActLink)
                    {
                        linkTest.AddAction(action);
                        tnTestLnk.Nodes.Add(tnAction);
                    }
                    else
                    {
                        test.AddAction(action);
                        tnTest.Nodes.Add(tnAction);
                    }
                }
            }
            // Add tests
            tnPage.Nodes.Add(tnTest);
            page.AddTest(test);
            // Add link tests
            tnPage.Nodes.Add(tnTestLnk);
            page.AddTest(linkTest);
            // Add page
            tv.Nodes.Add(tnPage);
            scenario.Pages.Add(page);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// called when we start a new recording
 /// </summary>
 /// <param name="HtmlPage"></param>
 internal bool Initialize(HtmlDocument HtmlPage)
 {
     currentPage      = new wxPage();
     currentPage.Name = "First Auto-Page";
     currentTest      = new wxTsSimple("Automatic test");
     scenario         = new wxScenario();
     if (HtmlPage != null)
     {
         string name = String.Format("Scenario Recorded on {0}", DateTime.Now.ToLongTimeString());
         scenario          = new wxScenario();
         scenario.Name     = String.Format("Page {0} captured on ", HtmlPage.Title, DateTime.Now.ToString("R"));
         scenario.StartUrl = HtmlPage.Url.ToString();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 internal void Completed(HtmlDocument htmlDocument)
 {
     currentPage.AddTest(currentTest);
     currentTest = new wxTsSimple("Next Test");
 }