static void ExportCustomTableStyles()
        {
            using (Presentation pres = new Presentation("table.pptx"))
            {
                const string templatesPath = "templates\\single-page";
                const string outputPath    = "custom-table-styles";

                var options = new WebDocumentOptions
                {
                    TemplateEngine = new RazorTemplateEngine(),
                    OutputSaver    = new FileOutputSaver(),
                    EmbedImages    = false
                };

                // setup global document values
                WebDocument document = new WebDocument(options);
                SetupGlobals(document, options, outputPath);

                // add common structure (except table template)
                ExportCustomTableStyles_AddCommonStructure(pres, document, templatesPath, outputPath, options.EmbedImages);

                // add custom table template
                document.Input.AddTemplate <Table>("table", @"custom-templates\table-custom-style.html");

                // add custom table styles
                document.Input.AddTemplate <Presentation>("table-custom-style", @"custom-templates\styles\table-custom-style.css");
                document.Output.Add(Path.Combine(outputPath, "table-custom-style.css"), "table-custom-style", pres);

                // add custom index - it's just a copy of the standard "index.html", but includes a reference to "table-custom-style.css"
                document.Input.AddTemplate <Presentation>("index", @"custom-templates\index-table-custom-style.html");

                document.Save();
            }
        }
Example #2
0
        void DHCP_Reserve_Rules()
        {
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            Delay.Seconds(30);
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']");
            //	/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']

            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            //if it is just 1 row  need to check if it is an invalid filter - No reserved rule!
            if (rowsCnt == 1)
            {
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                foreach (TdTag MacCol in cols)
                {
                    //Report.Info("Column",j.ToString());
                    Report.Info(MacCol.InnerText);
                    if (MacCol.InnerText.ToString().StartsWith("No reserved rule"))                     //No reserved rule! --R3.7
                    //Report.Info("No DHCP filtering rule exists !!!");
                    {
                        Report.Success("DHCP Filter ", "There are No DHCP rule exists  !!");
                        return;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Report.Info("DHCP_Resv Rule(s) ", rowsCnt.ToString());
        }
        private static void ExportCustomTableStyles_AddCommonStructure(
            Presentation pres,
            WebDocument document,
            string templatesPath,
            string outputPath,
            bool embedImages)
        {
            AddCommonStylesTemplates(document, templatesPath);

            document.Input.AddTemplate <Slide>("slide", Path.Combine(templatesPath, "slide.html"));
            document.Input.AddTemplate <AutoShape>("autoshape", Path.Combine(templatesPath, "autoshape.html"));
            document.Input.AddTemplate <TextFrame>("textframe", Path.Combine(templatesPath, "textframe.html"));
            document.Input.AddTemplate <Paragraph>("paragraph", Path.Combine(templatesPath, "paragraph.html"));
            document.Input.AddTemplate <Paragraph>("bullet", Path.Combine(templatesPath, "bullet.html"));
            document.Input.AddTemplate <Portion>("portion", Path.Combine(templatesPath, "portion.html"));
            document.Input.AddTemplate <VideoFrame>("videoframe", Path.Combine(templatesPath, "videoframe.html"));
            document.Input.AddTemplate <PictureFrame>("pictureframe", Path.Combine(templatesPath, "pictureframe.html"));;
            document.Input.AddTemplate <Shape>("shape", Path.Combine(templatesPath, "shape.html"));

            AddSinglePageCommonOutput(pres, document, outputPath);

            AddResourcesOutput(pres, document, embedImages);

            AddScriptsOutput(document, templatesPath);
        }
Example #4
0
        public void Verify_and_Validate_Wifi_Good_Password_Result()
        {
            //capture the result
            //Report.Screenshot();

            // "wifiWizardTable" path : /dom[@domain='192.168.0.1']//div[#'WiFiNetwork_Frame_0']/div[1]/table[2]
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WiFiNetwork_Frame_0']/div[1]/table[2]");

            //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'wifiWizardTable']");
            //Report.Screenshot("New Port Triggering Rule", myTable.Element,true);
            //Report.Info(myTable.GetInnerHtml().ToString());
            Report.Screenshot("Wifi_Password Config", myTable, false);

            /*
             * //highlight the new port triggering rule
             * IList<TrTag> rows = myTable.Find<TrTag>("./tbody//tr");
             * int rowsCnt = rows.Count;
             * Report.Info("Total Rows",rowsCnt.ToString());
             *
             *          int rowNum = 1;
             *          foreach (var row in rows)
             *          {
             *                  //Report.Info(row.GetInnerHtml().ToString());
             *                  //Report.Info("<---This port triggering rule is disabled from the list--->");
             *
             *                  if(rowNum == rowsCnt){
             *                          Report.Screenshot("Wifi_Password Config",row.Element,true);
             *                          break;
             *                  }
             *                  rowNum++;
             *          }
             */
        }
Example #5
0
        public DomElement GetPageBody(DomElement hostNode)
        {
            if (_contentNode != null)
            {
                return(_contentNode);
            }
            WebDocument ownerdoc = hostNode.OwnerDocument;

            _contentNode = ownerdoc.CreateElement("div");
            if (_contentUI != null)
            {
                //add content ui to the body of page
                //creat html wrapper for this ...

                //  throw new NotImplementedException();
                //reimpl here again
                LayoutFarm.Composers.HtmlDocument htmldoc = (LayoutFarm.Composers.HtmlDocument)ownerdoc;
                var wrapperElement = htmldoc.CreateWrapperElement("x",
                                                                  (RootGraphic rootgfx, out RenderElement renderE, out object controller) =>
                {
                    renderE    = _contentUI.GetPrimaryRenderElement(rootgfx);
                    controller = _contentUI;
                });
                _contentNode.AddChild(wrapperElement);
            }
            return(_contentNode);
        }
        //private int paramPierwszeRuchomePole;

        public SilverlightTableEditorWindow(WebDocument openWebsite, int?browserId, string idOkna = "", bool ignoreHeader = false, bool detailsPresenter = false, int ktoraTabelka = 0, bool emptyWindow = false, bool znajdzWKontenerze = true)
            : base(openWebsite, browserId)
        {
            _znajdzWKontenerze = znajdzWKontenerze;
            WaitForLoadInWindow();
            if (idOkna != "")
            {
                _okno = OpenWebsite.FindSingle <Form>(string.Format(".//form/form[@name='{0}' and @visible='true']", idOkna));
            }
            if (idOkna == "")
            {
                _okno = OpenWebsite.FindSingle <Form>(string.Format(".//form/form[@visible='true']"));
            }
            if (_znajdzWKontenerze)
            {
                _container = _okno.FindSingle <Container>(".//container[@automationid='scrollViewer' and @visible='true']");
            }
            if (!emptyWindow)
            {
                InternalTable = PobierzTabelkeDoEdycji(detailsPresenter, ignoreHeader, ktoraTabelka);
            }

            paramDetailsPresenter = detailsPresenter;
            paramIgnoreHeader     = ignoreHeader;
            paramKtoraTabelka     = ktoraTabelka;
        }
Example #7
0
        public void Validate_WPS_PIN()
        {
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PriSecurityStatusTable']");
            IList<TdTag> cols = myTable.Find<TdTag>("./tbody//td");
            //Report.Info(" Total columns ",cols.Count.ToString());

            bool isValidPIN = true;
            foreach(TdTag col in cols)
            {
                Report.Info("WPS PIN Value",col.InnerText);
                Report.Info("WPS PIN Length",col.InnerText.Length.ToString());
                if(col.InnerText.Length < 8){
                    isValidPIN = false;
                }
                break;
            }
            if(isValidPIN){
                Report.Success("Valid WPS PIN");
            }else{
                Report.Failure("Invalid WPS PIN");
            }
            TableTag table_WPS_PIN = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PriSecurityStatusTable']");
            Report.Screenshot("WPS_PIN_Length",table_WPS_PIN.Element,false);
        }
Example #8
0
        public CssBox BuildCssRenderTree(WebDocument webdoc,
                                         CssActiveSheet cssActiveSheet,
                                         RenderElement containerElement)
        {
            HtmlDocument htmldoc = webdoc as HtmlDocument;

            if (htmldoc == null)
            {
                //TODO: fixed here
                throw new NotSupportedException();
            }
            htmldoc.CssActiveSheet = cssActiveSheet;
            htmldoc.SetDocumentState(DocumentState.Building);
            //----------------------------------------------------------------

            TopDownActiveCssTemplate activeTemplate = new TopDownActiveCssTemplate(cssActiveSheet);

            PrepareStylesAndContentOfChildNodes((HtmlElement)htmldoc.RootNode, activeTemplate);
            //----------------------------------------------------------------


            //TODO: review here, we should create cssbox at  document.body?
            CssBox bridgeBox = HtmlHost.CreateBridgeBox(_htmlHost.GetHtmlTextService(), containerElement);

            ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(bridgeBox);//set bridgeBox as principal box of root node
            _htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true);
            htmldoc.SetDocumentState(DocumentState.Idle);
            //----------------------------------------------------------------
            //SetTextSelectionStyle(htmlCont, cssData);
            return(bridgeBox);
        }
        void Count_Ipv4_PortFiltering_Rules()
        {
            //count total number of port triggering rules
            Report.LogHtml(ReportLevel.Info, "TestCase", "<b>IPv4_PortFiltering Count</b>");
            int TotalRows = 0;

            Delay.Seconds(30);
            WebDocument webDocument1 = "/dom[@domain='192.168.0.1']";

            webDocument1.WaitForDocumentLoaded();
//            Delay.Seconds(40);
            TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']");

            IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr");

            TotalRows = rows1.Count;
            if (TotalRows == 1)
            {
//              int rowNum = 1;
                foreach (var row in rows1)
                {
//			        Report.Info("Row: " + rowNum);
//			        Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
//			        int colNum = 1;
                    int colCnt = cols.Count;
//			        Report.Info(" No of cols : " + colCnt.ToString());
                    if (colCnt == 1)            //if there is only one column - //No filtering rule applied!
                    {
                        foreach (TdTag MacCol in cols)
                        {
//			                Report.Info("MacCol: " + colNum);
                            String colVal = MacCol.InnerText.ToString();
//			            Report.Info("MacCol Info: "+MacCol.InnerText);
//			            Report.Info("MacCol Info: " + colVal);
                            if (colVal.StartsWith("No filtering rule"))
                            {
                                Report.Info("There are No filtering rule !");
                                //Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.ranorex.com/'>Visit www.ranorex.com</a>");
                                Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.virginmedia.com/'>Visit www.virginmedia.com</a>");
                                //<b>and this is bold text</b>
                            }
                        }
                    }
                    else
                    {
                        String Total_Rules = " There is only " + TotalRows.ToString() + "	rule exist";
                        Ranorex.Report.Success(Total_Rules);
                    }
                }
            }
            else
            {
                String Total_Rules = "Totally, There are " + TotalRows.ToString() + "	Rules";
                //Report.Info(" Ipv4_PortFiltering_Rules",TotalRows.ToString());
                // Report.Info(" IP_PortFilter",Total_Rules);
                Ranorex.Report.Success(Total_Rules);
                //Ranorex.Report.Failure("Failure Message");
            }
        }
        public void Count_List_Of_Reserv_List()
        {
            Delay.Seconds(30);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            TableTag      myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']");
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            Report.Info("Total Reservation_List", rowsCnt.ToString());
            if (rowsCnt == 32)
            {
                Report.Info("Total Reservation_List", rowsCnt.ToString());
                TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = true;
            }
            else if (rowsCnt < 32)
            {
                Report.Info("Total No of Reservation_List is less than 32");
                TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = false;
            }
            else
            {
                Report.Info("Total No of Reservation_List is more than 32");
                TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = false;
            }
        }
Example #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            string filename = @"..\..\..\HtmlRenderer.Demo\Samples\ClassicSamples\00.Intro.htm";

            //1. blank html
            var fileContent = "<html><body><div id=\"a\">AAA</div></body></html>";

            easeViewport.LoadHtml(filename, fileContent);
            //2. access dom

            WebDocument webdoc = easeViewport.GetHtmlDom();
            var         div_a  = webdoc.GetElementById("a");

            div_a.AddChild("div", div =>
            {
                div.AddChild("div", div_1 =>
                {
                    div_1.SetAttribute("style", "font:10pt tahoma");
                    div_1.AddChild("span", span =>
                    {
                        span.AddTextContent("test1");
                    });
                    div_1.AddChild("span", span =>
                    {
                        span.AddTextContent("test2");
                    });
                });
            });
        }
        public static WebDocument ToMultiPageWebDocument(
            this Presentation pres,
            WebDocumentOptions options,
            string templatesPath,
            string outputPath)
        {
            CheckArguments(options, templatesPath, outputPath);

            WebDocument document = new WebDocument(options);

            SetGlobals(document, options, outputPath);

            const string localSlidesPath = "slides";

            string slidesPath  = Path.Combine(outputPath, localSlidesPath);
            string stylesPath  = Path.Combine(outputPath, "styles");
            string scriptsPath = Path.Combine(outputPath, "scripts");

            document.Global.Put("slidesPath", slidesPath);
            document.Global.Put("stylesPath", stylesPath);
            document.Global.Put("scriptsPath", scriptsPath);

            document.AddCommonInputOutput(options, templatesPath, outputPath, pres);

            document.AddMultiPageInputTemplates(templatesPath);
            document.AddMultiPageOutputFiles(outputPath, slidesPath, localSlidesPath, pres);

            if (!options.EmbedImages)
            {
                document.AddThumbnailsOutput(document.Global.Get <string>("imagesPath"), pres);
            }

            return(document);
        }
Example #13
0
 public SilverlightInfoPopup(WebDocument openWebsite, int?browserId)
     : base(openWebsite, browserId)
 {
     OpenWebsite = openWebsite;
     BrowserId   = browserId;
     KtoryPopup  = -1;
 }
Example #14
0
        public MainForm()
        {
            //BotBase.DefaultSettings.SaveSetting("axLogin", "demonstration");
            //BotBase.DefaultSettings.SaveSetting("axPassword", "demonstration");
            InitializeComponent();
            BotBase.MainForm  = this;
            BotBase.MainPanel = dockPanel1;
            webDocument       = new WebDocument(true);
            webDocument.Show(BotBase.MainPanel);
            BotBase.LogForm = new Log();
            BotBase.LogForm.Show(BotBase.MainPanel);
            BotBase.LogForm.DockHandler.DockState = DockState.DockRightAutoHide;
            BotBase.WebControl        = webDocument.webControl;
            BotBase.WebControl.Source = new Uri(BotBase.GameUrl);
            BotBase.WebControlHandle  = BotBase.WebControl.Handle;
            //if (!Registration.Check())
            //{
            //    TestLicence = true;
            //    RegisterProgramm.Visible = true;
            //    TestModeTimerEl.Visible = true;
            //    TestModeTimer.Enabled = true;
            //    TestModeTimer.Start();
            //}

            Auto.Init();
        }
        static void ExportHelloWorldWithInlineCss()
        {
            using (Presentation pres = new Presentation("demo.pptx"))
            {
                WebDocumentOptions options = new WebDocumentOptions {
                    TemplateEngine = new RazorTemplateEngine(), OutputSaver = new FileOutputSaver()
                };
                WebDocument document = new WebDocument(options);

                const string templatesPath = "templates\\single-page";
                const string outputPath    = "inline-css";

                // setup global document values
                SetupGlobals(document, options, outputPath);

                document.Input.AddTemplate <Presentation>("index", @"custom-templates\index-inline-css.html");

                AddCommonStylesTemplates(document, templatesPath);
                AddCommonShapeTemplates(document, templatesPath);

                AddSinglePageCommonOutput(pres, document, outputPath);
                AddResourcesOutput(pres, document, options.EmbedImages);
                AddScriptsOutput(document, templatesPath);

                document.Save();
            }
        }
Example #16
0
        //Uwaga! Funkcja stanowi podstawę działania testów również dla innych aplikacj, np. Erato!
        public static HtmlTable PobierzTabelePodNaglowkiem(string gridId, WebDocument OpenWebsite, string hdName, int?browserId, string tableId, int iloscKolumn = 0, Boolean enforceVisible = false)
        {
            HtmlTable table     = null;
            var       divHeader = OpenWebsite.Find <DivTag>(string.Format(".//div[id='{0}']//div[id~'header$']", gridId));

            for (int i = 0; i < divHeader.Count(); i++)
            {
                var headerName = divHeader[i].FindDescendant <SpanTag>().InnerText;
                if (headerName.Contains(hdName))
                {
                    divHeader[i].EnsureVisible();
                    var id     = divHeader[i].Parent.Id;
                    var myPath = "/div[@id='" + id + "']/";

                    // k.o - sekcje mogą zawierać kilka teabelek, które mogą być niewidoczne mimo widocznej nazwy sekcji
                    // dlatego trzeba zapewnić jakiś mechanizm do uwidocznenia takiej tabelki, dlatego że f-cja klasy HtmlTable
                    // pobierająca tabelki pobiera tylko tabele widoczne
                    if (enforceVisible)
                    {
                        var pth    = string.Format("./{0}/div[@id~'{1}']", myPath, tableId);
                        var divTag = OpenWebsite.Find <DivTag>(pth);
                        if (divTag.Count > 0)
                        {
                            var div = divTag.First();
                            div.EnsureVisible();
                        }
                    }

                    table = new HtmlTable(OpenWebsite, tableId, browserId, true, myPath, 0, 0, 0, iloscKolumn);
                    break;
                }
            }
            return(table);
        }
        static void ExportHelloWorld()
        {
            using (Presentation pres = new Presentation())
            {
                IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 100, 150);
                shape.TextFrame.Text = "Hello World";

                WebDocumentOptions options = new WebDocumentOptions
                {
                    TemplateEngine = new RazorTemplateEngine(), // we will use Razor template engine, other template engines can be used by implementing ITemplateEngine
                    OutputSaver    = new FileOutputSaver()      // other result savers can be used by implementing IOutputSaver interface
                };
                WebDocument document = new WebDocument(options);

                // add document "input" - what source will be used to generate HTML document
                document.Input
                .AddTemplate <Presentation>( // template will have Presentation as a "model" object (Model.Object)
                    "index",                 // template key - needed by template engine to match an object (Presentation) to the template loaded from disk ("shape-template-hello-world.html")
                    @"custom-templates\\shape-template-hello-world.html");

                // add output - how resulting HTML document will looks like when it will be exported to the disk
                document.Output.Add(
                    "hello-world.html", // output file path
                    "index",            // template key that will be used for this file (we set it in a previous statement)
                    pres);              // an actual Model.Object instance

                document.Save();
            }
        }
        private static void AddScriptsOutput(WebDocument document, string templatesPath)
        {
            string scriptsPath = document.Global.Get <string>("scriptsPath");

            document.AddScriptsOutput(scriptsPath, Path.Combine(templatesPath, @"scripts\jquery-3.5.1.min.js"), "jquery.js");
            document.AddScriptsOutput(scriptsPath, Path.Combine(templatesPath, @"scripts\anime.min.js"), "anime.js");
        }
 private static void AddCommonStylesTemplates(WebDocument document, string templatesPath)
 {
     document.Input.AddTemplate <Presentation>("styles-pres", Path.Combine(templatesPath, @"styles\pres.css"));
     document.Input.AddTemplate <MasterSlide>("styles-master", Path.Combine(templatesPath, @"styles\master.css"));
     document.Input.AddTemplate <Presentation>("scripts-animation",
                                               Path.Combine(templatesPath, @"scripts\animation.js"));
 }
        public void Wireless_Mode_Selection_5GHz(string argument1)
        {
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Report.Info("Wireless Mode(argument1) : " + argument1);
            //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
            //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WiFi50ChannelBW']");
            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WirelessMode50']");
            Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {
                Report.Info(optTag.InnerText);
                if (optTag.InnerText.Trim() == argument1.Trim())
                {
                    Report.Info("5GHz Matching-True", argument1);
                    optTag.Selected = true;
                    optTag.Click();
                    optTag.PerformClick();
                    break;
                }
            }
//          TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency50GHz']/table");
//          Report.Screenshot("Wireless_5GHz",table_2GHz.Element,false);
            Report.Screenshot();
        }
Example #21
0
        public void Capture_Screen_For_Result()
        {
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Ranorex.DivTag WirelessFrequencyTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency']");
            //Report.Info(WirelessFrequencyTag.GetInnerHtml().ToString());
            //Report.Info(TestSuite.Current.GetTestCase);
//          string tcName = TestCase.Current.Name;		//obsolete in 6.x
            string tcName = TestCaseNode.Current.Name;

            //Report.Info(tcName);
            if (tcName == "Confirm_Enable_Guest_Network")
            {
                //Report.Log(ReportLevel.Info,"Guest Network Enabled Successfully !!!");
                Report.Success("Guest Network Enabled Successfully !!!");
            }
            else if (tcName == "Disable_Guest")
            {
                //Report.Log(ReportLevel.Info,"Guest Network Disabed Successfully !!!");
                Report.Success("Guest Network Disabed Successfully !!!");
            }
            Report.Screenshot("WirelessFrequency", WirelessFrequencyTag.Element, true);

            /*
             *  WebDocument webDocument = "/dom[@domain='192.168.0.1']";
             *      Ranorex.TableTag WirelessFrequencyTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'strengthBar_Passphrase']/table");
             *      //Report.Info(WirelessFrequencyTag.GetInnerHtml().ToString());
             *      Report.Screenshot("WirelessFrequency",WirelessFrequencyTag.Element,true);
             */
        }
        public void Add_Existing_Port_Triggering_Rules()
        {
            //Add_Existing_Port_Triggering_Rules
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //highlight the new port triggering rule
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            Report.Info("Total Rules(After Add)", rowsCnt.ToString());

            if (TotalRows > 1 && TotalRows == rowsCnt)  // no rows are added
            {
                Report.Success("PortTriggerRule", "Unable to add this new rule because of the below reasons !!! ");
                myTable.EnsureVisible();
                Delay.Seconds(5);
                //Report.Screenshot("PortTriggerRule",myTable.Element,true);
                Report.Screenshot();
            }
            else
            {
                Report.Failure("PortTriggerRule", "Duplicate Rules Area added to the table");
                myTable.EnsureVisible();
                Delay.Seconds(5);
                //Report.Screenshot("PortTriggerRule",myTable.Element,true);
                Report.Screenshot();
            }
        }
        private void Init()
        {
            // Your recording specific initialization code goes here.
            Delay.Seconds(20);
            WebDocument webDocument1 = "/dom[@domain='192.168.0.1']";

            webDocument1.WaitForDocumentLoaded();
            TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']");

            //highlight the new MACFiltering rule
            IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr");

            TotalRows = rows1.Count;
            Report.Info("------Inside Init()------ TotalRows", TotalRows.ToString());
            if (TotalRows == 1)
            {
                foreach (var row in rows1)
                {
                    IList <TdTag> cols         = row.Find <TdTag>("./td");
                    string        tempColCount = cols.Count.ToString();
                    initColCount = Int32.Parse(tempColCount);
                    Report.Info("initColCount : " + initColCount.ToString());
                }
            }
        }
Example #24
0
        private void button2_Click(object sender, EventArgs e)
        {
            //1.init html
            var html = "<html><body><div id=\"a\">AAA</div></body></html>";

            easeViewport.LoadHtmlString("", html);
            //2. access dom

            WebDocument webdoc = easeViewport.GetHtmlDom();
            var         div_a  = webdoc.GetElementById("a");

            div_a.AddChild("div", div =>
            {
                div.AddChild("div", div_1 =>
                {
                    div_1.SetAttribute("style", "font:10pt tahoma");
                    div_1.AddChild("span", span =>
                    {
                        span.AddTextContent("test1");
                    });
                    div_1.AddChild("span", span =>
                    {
                        span.AddTextContent("test2");
                    });
                });
            });
        }
Example #25
0
        void Count_Ipv6_PortFiltering_Rules()
        {
            //count total number of port triggering rules
            Report.LogHtml(ReportLevel.Info, "TestCase", "<b>IPv6_PortFiltering Count</b>");
            int TotalRows = 0;

            Delay.Seconds(60);
            WebDocument webDocument1 = "/dom[@domain='192.168.0.1']";

            webDocument1.WaitForDocumentLoaded();

            TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv6FilterTable']");

            IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr");

            TotalRows = rows1.Count;
            Ranorex.Report.Success(" Total Number of Rows in the table : " + TotalRows.ToString());
            //Report.Info(" Ipv4_PortFiltering_Rules",TotalRows.ToString());
            // Report.Info(" IP_PortFilter",Total_Rules);

            //Ranorex.Report.Failure("Failure Message");
            //Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.ranorex.com/'>Visit www.ranorex.com</a>");
//            Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.virginmedia.com/'>Visit www.virginmedia.com</a>");
            //<b>and this is bold text</b>
            int    j           = 1;
            bool   isRuleExist = true;
            String Total_Rules = "";

            if (TotalRows > 0)
            {
                IList <TdTag> cols = myTable1.Find <TdTag>("./tbody//td");
                Ranorex.Report.Info(" Total cols : " + cols.Count.ToString());
                foreach (TdTag col in cols)
                {
//                  Report.Info(" col value : " + col.InnerText.ToString());
                    if (j == 1 && TotalRows == 1 && col.InnerText.ToString().StartsWith("No filtering rule applied!"))
                    {
                        isRuleExist = false;
                        //return;
                        Report.Info(" There are no active IPv6 and Port Filtering rules ");
                        TotalRows = -1;
                        break;
                    }
                    else
                    {
                        Total_Rules = "Totally, There are " + TotalRows.ToString() + "  Rules";
//                      Ranorex.Report.Success(Total_Rules);
                        isRuleExist = true;
                        break;
                    }
                }
                if (isRuleExist)
                {
//                  Report.Info(" Total Rules",TotalRows.ToString());
                    Report.Info(Total_Rules);
//					Report.Info(" Total IPv6 and Port Filtering Rules : " + TotalRows.ToString());
                }
            }
        }
Example #26
0
        public void Validate_DHCPv6_Configuration_Parameters()
        {
            //Validate_DHCPv6_Configuration
            Report.Info("Validate_DHCPv6_Configuration");
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable1    = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'DHCPv6server']/table");
            // Ranorex.InputTag IPv4FirewallProtectTag ="/dom[@domain='192.168.0.1']//div[#'tr_EnableFirewall']/input[#'EnableFirewall']";

            //count the rows
            IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr");

            TotalRows1 = rows1.Count;
            Report.Info("Total rows ", TotalRows1.ToString());


            if (TotalRows1 > 0)
            {
                int           rowNum = 1;
                IList <TrTag> rows   = myTable1.Find <TrTag>("./tbody//tr");
//				Report.Info("rows(tr)",rows.Count.ToString());

                //walkthrough all the columns
                foreach (TrTag row in myTable1.Find("./ tbody /tr"))
                {
                    if (rowNum > 1)
                    {
                        int colNum = 1;
                        // Get all cells from the row
                        /* rowInfo += " All Cells : ";  */
                        foreach (TdTag cell in row.Find("./ td"))
                        {
                            /* rowInfo += cell . InnerText + ", "; */
//							if(colNum == 1 || colNum == 3 ){
//								Report . Info ("cell info: ", cell.InnerText);
//							}
                            // Move the mouse to each cell element
                            cell.MoveTo();
                            // Set css style
                            cell.SetStyle(" background - color ", " #33 ff00 ");
                            colNum++;
                        }
                        //Report . Info ( rowInfo );
                    }
                    rowNum++;
                }

                /*
                 * IList<TdTag> cols = myTable1.Find<TdTag>("./tbody//td");
                 * foreach(TdTag col in cols)
                 * {
                 * Report.Info(col.InnerText);
                 * colNum++;
                 * }//end of forloop
                 */
            }

            // Report.Screenshot();
            Report.Screenshot("DHCPv6server", myTable1.Element, true);
        }
        static void SetupGlobals(WebDocument document, WebDocumentOptions options, string outputPath)
        {
            PresentationExtensions.SetGlobals(document, options, outputPath);

            document.Global.Put("slidesPath", outputPath);
            document.Global.Put("stylesPath", outputPath);
            document.Global.Put("scriptsPath", outputPath);
        }
Example #28
0
        /// <summary>
        /// Scieżka do lewego grida
        /// </summary>
        //private string pathToSwitchPanelLeft = "/div[@id~'vswitchpanel' and id~'-targetEl']/div[@id~'vgrid' and childindex=0]";
        //public string PathToSwitchPanelLeft
        //{
        //    get { return pathToSwitchPanelLeft; }
        //    set { pathToSwitchPanelLeft = value; }
        //}

        ///// <summary>
        ///// Scieżka do prawego grida
        ///// </summary>
        //private string pathToSwitchPanelRight = "/div[@id~'vswitchpanel' and id~'-targetEl']/div[@id~'vgrid' and childindex=2]";
        //public string PathToSwitchPanelRight
        //{
        //    get { return pathToSwitchPanelRight; }
        //    set { pathToSwitchPanelRight = value; }
        //}

        public VSwitchPanel(WebDocument openWebsite, int?browserId, string idOkna)
            : base(openWebsite, browserId, idOkna)
        {
            WaitForLoad();
            var _headerWidow = OpenWebsite.FindSingle <SpanTag>(string.Format(".//div[@class~'x-window']//span[@innertext='{0}' and @class~'x-window-header-text']", idOkna));

            this._windowDialog = _headerWidow.Parent.Parent.Parent.Parent.Parent.Parent.As <DivTag>();
        }
 static void ExportDefault()
 {
     using (Presentation pres = new Presentation("demo.pptx"))
     {
         WebDocument document = pres.ToSinglePageWebDocument("templates\\single-page", @"single-page-output");
         document.Save();
     }
 }
 public SyncService(WebDocument webDocument, ICustomDateFormat customDateFormat,
                    ProjectSettings projectSettings, QueryFactory queryFactory)
 {
     _webDocument      = webDocument;
     _customDateFormat = customDateFormat;
     _projectSettings  = projectSettings;
     _queryFactory     = queryFactory;
 }
Example #31
0
 private WebDoc()
 {
     _doc = "/dom[@domain='localhost:8057']";  
     _doc.WaitForDocumentLoaded();
 }
Example #32
0
 public override void ResetParser()
 {
     this._resultHtmlDoc = null;
     this.openEltStack.Clear();
 }
Example #33
0
        public override void Parse(TextSource textSnapshot, WebDocument htmldoc, DomElement currentNode)
        {
            this._resultHtmlDoc = htmldoc;
            char[] copyBuffer = textSnapshot.ActualSnapshot.Copy(0, textSnapshot.ActualSnapshot.Length);
            using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(copyBuffer)))
            using (var textReader = new System.IO.StreamReader(ms))
            {
                var tokenizer = new HtmlTokenizer(textReader);
                HtmlToken token;
                while (tokenizer.ReadNextToken(out token))
                {
                    switch (token.Kind)
                    {
                        case HtmlTokenKind.Data:
                            {
                                var text = (HtmlDataToken)token;
                                currentNode.AddChild(_resultHtmlDoc.CreateTextNode(text.Data.ToCharArray()));
                            }
                            break;
                        case HtmlTokenKind.Tag:
                            {
                                var tag = (HtmlTagToken)token;
                                if (!tag.IsEndTag)
                                {
                                    //open tag 
                                    DomElement elem = this._resultHtmlDoc.CreateElement(null, tag.Name);
                                    currentNode.AddChild(elem);
                                    foreach (var attribute in tag.Attributes)
                                    {
                                        var attr = this._resultHtmlDoc.CreateAttribute(null, attribute.Name);
                                        if (attribute.Value != null)
                                        {
                                            attr.Value = attribute.Value;
                                        }
                                        elem.AddAttribute(attr);
                                    }
                                    if (!tag.IsEmptyElement)
                                    {
                                        openEltStack.Push(currentNode);
                                        currentNode = elem;
                                    }
                                }
                                else
                                {
                                    //this is end tag
                                    //check end tag match or not
                                    int tagNameIndex = _resultHtmlDoc.AddStringIfNotExists(tag.Name);
                                    if (currentNode.Name == tag.Name)
                                    {
                                        currentNode = openEltStack.Pop();
                                    }
                                    else
                                    {
                                        //if not equal then check if current node need close tag or not
                                        int count = 3;//?
                                        bool ok = false;
                                        while (count > 0)
                                        {
                                            if (HtmlTagMatching.IsSingleTag(currentNode.LocalNameIndex))
                                            {
                                                if (openEltStack.Count > 0)
                                                {
                                                    currentNode = openEltStack.Pop();
                                                }
                                                if (currentNode.LocalName == tag.Name)
                                                {
                                                    if (openEltStack.Count > 0)
                                                    {
                                                        currentNode = openEltStack.Pop();
                                                        ok = true;
                                                        break;
                                                    }
                                                }
                                            }
                                            else if (HtmlTagMatching.CanAutoClose(currentNode.LocalNameIndex))
                                            {
                                                if (openEltStack.Count > 0)
                                                {
                                                    currentNode = openEltStack.Pop();
                                                }
                                                if (currentNode.LocalName == tag.Name)
                                                {
                                                    if (openEltStack.Count > 0)
                                                    {
                                                        currentNode = openEltStack.Pop();
                                                        ok = true;
                                                        break;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                //implement err handling here!
                                                throw new NotSupportedException();
                                            }
                                            count--;
                                        }
                                        if (!ok)
                                        {
                                            throw new NotSupportedException();
                                        }
                                    }
                                }
                            }
                            break;
                        case HtmlTokenKind.Comment:

                            break;
                        case HtmlTokenKind.DocType:

                            break;
                        default:
                            {
                            }
                            break;
                    }
                }
            }
        }
Example #34
0
 public HtmlTextNode(WebDocument ownerDoc, char[] buffer)
     : base(ownerDoc, buffer)
 {
 }
Example #35
0
 public abstract void Parse(TextSource textSnapshot, WebDocument htmldoc, DomElement currentNode);
Example #36
0
        public void Parse(TextSource textSnapshot, WebDocument htmldoc, DomElement currentNode)
        {
            this.Parse(textSnapshot.ActualSnapshot, htmldoc, currentNode);

        }
Example #37
0
        /// <summary>
        /// parse to htmldom
        /// </summary>
        /// <param name="stbuilder"></param>
        internal void Parse(TextSnapshot textSnapshot, WebDocument htmldoc, DomElement currentNode)
        {
            this.textSnapshot = textSnapshot;
            //1. lex 
            lexer.BeginLex();
            //2. mini parser    
            this.curHtmlNode = currentNode;
            this._resultHtmlDoc = htmldoc;
            lexer.Analyze(textSnapshot);
            lexer.EndLex();

        }
Example #38
0
 public void ResetParser()
 {
     this._resultHtmlDoc = null;
     this.openEltStack.Clear();
     this.curHtmlNode = null;
     this.curAttr = null;
     this.curTextNode = null;
     this.parseState = 0;
     this.textSnapshot = null;
 }