Пример #1
0
        static void Main(string[] args)
        {
            //var form = new ConsoleForm(DocumentBuilder.Html(new Uri("http://localhost:48609/PostNormal"), new Configuration { AllowRequests = true }));
            //var form = new ConsoleForm("<form method=post action='http://requestb.in/1hc34c81'><input type=hidden name=q value=r><input type=text name=Name><input type=text name=Birthday><input type=text name=Remark></form>");
            //var form = new ConsoleForm("<form method=post action='http://requestb.in/1hc34c81' enctype='multipart/form-data'><input type=hidden name=q value=r><input type=text name=Name><input type=text name=Birthday><input type=text name=Remark><input type=file name=myfile></form>");
            //var form = new ConsoleForm("<form method=post action='http://requestb.in/1hc34c81' enctype='text/plain'><input type=hidden name=q value=r><input type=text name=Name><input type=text name=Birthday><input type=text name=Remark></form>");
            //form.FillInteractive();
            //form.Submit();

            TestAsync().Wait();

            CssSelectorTest.Slickspeed();

            TestCSSFrom("http://www.facebook.com");

            TestCSSFrom("http://www.tumblr.com");

            TestCSSFrom("http://www.flickr.com");

            TestCSS(Stylesheets.rsi, "a sample stylesheet");

            TestCSS(Stylesheets.CodeProject, "CodeProject's stylesheet");

            TestHtml(Snippets.Invalid, "an invalid snippet");

            ReadHtmlFiles(HtmlFiles.ResourceManager);

            TestHtmlFrom("http://www.imdb.com/", false);

            TestHtmlFrom("http://www.dailymail.co.uk/‎", false);

            TestHtmlFrom("http://news.google.com/", false);

            TestHtmlFrom("http://www.huffingtonpost.com/", false);

            TestHtmlFrom("http://www.nbcnews.com/", false);

            TestHtmlFrom("http://www.amazon.com/", false);

            TestHtmlFrom("http://www.yahoo.com/", false);

            TestHtmlFrom("http://www.codeproject.com/", false);

            TestHtmlFrom("http://www.florian-rappl.de/", false);
        }
Пример #2
0
        static void Main(string[] args)
        {
            CssSelectorTest.Slickspeed();

            //TestCSSFrom("http://www.facebook.com");

            //TestCSSFrom("http://www.tumblr.com");

            //TestCSSFrom("http://www.flickr.com");

            TestCSS(Stylesheets.rsi, "a sample stylesheet");

            TestCSS(Stylesheets.CodeProject, "CodeProject's stylesheet");

            TestHtml(Snippets.Invalid, "an invalid snippet");

            TestHtml(HtmlFiles.Test, "a test page");

            TestHtml(HtmlFiles.CodeProject, "CodeProject's webpage");

            TestHtml(HtmlFiles.Simon, "Simon's HP");

            TestHtml(HtmlFiles.W3C, "the W3C webpage");

            TestXml(XmlFiles.Note, "The XML note file");

            TestWebRequest("http://www.imdb.com/", false);

            TestWebRequest("http://www.dailymail.co.uk/‎", false);

            TestWebRequest("http://news.google.com/", false);

            TestWebRequest("http://www.huffingtonpost.com/", false);

            TestWebRequest("http://www.nbcnews.com/", false);

            TestWebRequest("http://www.amazon.com/", false);

            TestWebRequest("http://www.yahoo.com/", false);

            TestWebRequest("http://www.codeproject.com/", false);

            TestWebRequest("http://www.florian-rappl.de/", false);
        }
Пример #3
0
        static void Main(string[] args)
        {
            TestAsync().Wait();

            CssSelectorTest.Slickspeed();

            //TestCSSFrom("http://www.facebook.com");

            //TestCSSFrom("http://www.tumblr.com");

            //TestCSSFrom("http://www.flickr.com");

            TestCSS(Stylesheets.rsi, "a sample stylesheet");

            TestCSS(Stylesheets.CodeProject, "CodeProject's stylesheet");

            TestHtml(Snippets.Invalid, "an invalid snippet");

            ReadHtmlFiles(HtmlFiles.ResourceManager);

            TestHtmlFrom("http://www.imdb.com/", false);

            TestHtmlFrom("http://www.dailymail.co.uk/‎", false);

            TestHtmlFrom("http://news.google.com/", false);

            TestHtmlFrom("http://www.huffingtonpost.com/", false);

            TestHtmlFrom("http://www.nbcnews.com/", false);

            TestHtmlFrom("http://www.amazon.com/", false);

            TestHtmlFrom("http://www.yahoo.com/", false);

            TestHtmlFrom("http://www.codeproject.com/", false);

            TestHtmlFrom("http://www.florian-rappl.de/", false);
        }
Пример #4
0
        /// <summary>
        /// A standard test (Slickspeed). Found at:
        /// http://mootools.net/slickspeed/
        /// </summary>
        public static void Slickspeed()
        {
            var test = new CssSelectorTest();

            test.AddTests("body", "div", "body div", "div p", "div > p", "div + p", "div ~ p", "div[class^=exa][class$=mple]", "div p a",
                          "div, p, a", ".note", "div.example", "ul .tocline2", "div.example, div.note", "#title", "h1#title", "div #title",
                          "ul.toc li.tocline2", "ul.toc > li.tocline2", "h1#title + div > p", "h1[id]:contains(Selectors)", "a[href][lang][class]",
                          "div[class]", "div[class=example]", "div[class^=exa]", "div[class$=mple]", "div[class*=e]", "div[class|=dialog]",
                          "div[class!=made_up]", "div[class~=example]", "div:not(.example)", "p:contains(selectors)", "p:nth-child(even)",
                          "p:nth-child(2n)", "p:nth-child(odd)", "p:nth-child(2n+1)", "p:nth-child(n)", "p:only-child", "p:last-child", "p:first-child");

            try
            {
                test.LoadFromUrl("http://mootools.net/slickspeed/system/template.php");
            }
            catch (AggregateException)
            {
                Console.WriteLine();
                Console.WriteLine("Could not load the document from the given URL, switching to local version . . .");
                test.LoadFromSource(HtmlFiles.W3C);
            }

            test.Run();

            //test.Show("div > p");

            /*
             ***************************************************  final time should be between 12 and 407 ms  ***************************************************
             * body	                        0 ms | 1 found	    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
             * div	                            1 ms | 51 found	    1 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found
             * body div	                    1 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found	    2 ms | 51 found	    1 ms | 51 found
             * div p	                        2 ms | 140 found	1 ms | 140 found	0 ms | 140 found	0 ms | 140 found	3 ms | 140 found	1 ms | 140 found
             * div > p	                        2 ms | 134 found	1 ms | 134 found	0 ms | 134 found	0 ms | 134 found	2 ms | 134 found	1 ms | 134 found
             * div + p	                        2 ms | 22 found	    0 ms | 22 found	    0 ms | 22 found	    0 ms | 22 found	    3 ms | 22 found	    1 ms | 22 found
             * div ~ p	                        3 ms | 183 found	1 ms | 183 found	1 ms | 183 found	1 ms | 183 found	4 ms | 183 found	1 ms | 183 found
             * div[class^=exa][class$=mple]	2 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    2 ms | 43 found	    1 ms | 43 found
             * div p a	                        3 ms | 12 found	    1 ms | 12 found	    1 ms | 12 found	    0 ms | 12 found	    5 ms | 12 found	    1 ms | 12 found
             * div, p, a	                    3 ms | 671 found    3 ms | 671 found	1 ms | 671 found	1 ms | 671 found	8 ms | 671 found	1 ms | 671 found
             * .note	                        5 ms | 14 found	    1 ms | 14 found	    1 ms | 14 found	    0 ms | 14 found	    5 ms | 14 found	    1 ms | 14 found
             * div.example	                    1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
             * ul .tocline2	                2 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    9 ms | 12 found	    0 ms | 12 found
             * div.example, div.note	        2 ms | 44 found	    1 ms | 44 found	    0 ms | 44 found	    0 ms | 44 found	    4 ms | 44 found	    0 ms | 44 found
             #title	                        1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
             * h1#title	                    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 0 found
             * div #title	                    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found	    1 ms | 1 found
             * ul.toc li.tocline2	            1 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    2 ms | 12 found	    1 ms | 12 found
             * ul.toc > li.tocline2	        1 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    1 ms | 12 found	    1 ms | 12 found
             * h1#title + div > p	            0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    2 ms | 0 found	    0 ms | 0 found
             * h1[id]:contains(Selectors)	    1 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found	    1 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
             * a[href][lang][class]	        2 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    3 ms | 1 found	    1 ms | 1 found
             * div[class]	                    1 ms | 51 found	    0 ms | 51 found	    0 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    1 ms | 51 found
             * div[class=example]	            2 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found
             * div[class^=exa]	                1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
             * div[class$=mple]	            1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
             * div[class*=e]	                1 ms | 50 found	    0 ms | 50 found	    0 ms | 50 found	    0 ms | 50 found	    1 ms | 50 found	    1 ms | 50 found
             * div[class|=dialog]	            0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    1 ms | 0 found
             * div[class!=made_up]	            1 ms | 51 found	    2 ms | 51 found	    2 ms | 51 found	    2 ms | 51 found	    1 ms | 51 found	    1 ms | 0 found
             * div[class~=example]	            1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
             * div:not(.example)	            1 ms | 8 found	    0 ms | 8 found	    0 ms | 8 found	    0 ms | 8 found	    5 ms | 8 found	    0 ms | 8 found
             * p:contains(selectors)	        3 ms | 54 found	    3 ms | 54 found	    4 ms | 54 found	    3 ms | 54 found	    3 ms | 54 found	    1 ms | 57 found
             * p:nth-child(even)	            5 ms | 158 found	1 ms | 158 found	1 ms | 158 found	0 ms | 158 found	39 ms | 158 found	1 ms | 158 found
             * p:nth-child(2n)	                4 ms | 158 found	1 ms | 158 found	0 ms | 158 found	1 ms | 158 found	44 ms | 158 found	1 ms | 158 found
             * p:nth-child(odd)	            4 ms | 166 found	1 ms | 166 found	0 ms | 166 found	0 ms | 166 found	44 ms | 166 found	1 ms | 166 found
             * p:nth-child(2n+1)	            3 ms | 166 found	1 ms | 166 found	1 ms | 166 found	1 ms | 166 found	41 ms | 166 found	1 ms | 166 found
             * p:nth-child(n)	                3 ms | 324 found	1 ms | 324 found	1 ms | 324 found	1 ms | 324 found	43 ms | 324 found	1 ms | 324 found
             * p:only-child	                2 ms | 3 found	    0 ms | 3 found	    0 ms | 3 found	    0 ms | 3 found	    41 ms | 3  found	1 ms | 3 found
             * p:last-child	                2 ms | 19 found	    1 ms | 19 found	    0 ms | 19 found	    0 ms | 19 found	    41 ms | 19 found	0 ms | 19 found
             * p:first-child	                2 ms | 54 found	    1 ms | 54 found	    0 ms | 54 found	    1 ms | 54 found	    41 ms | 54 found	1 ms | 54 found
             */
        }
Пример #5
0
        /// <summary>
        /// A standard test (Slickspeed). Found at:
        /// http://mootools.net/slickspeed/
        /// </summary>
        public static void Slickspeed()
        {
            var test = new CssSelectorTest();
            test.AddTests("body", "div", "body div", "div p", "div > p", "div + p", "div ~ p", "div[class^=exa][class$=mple]", "div p a",
                "div, p, a", ".note", "div.example", "ul .tocline2", "div.example, div.note", "#title", "h1#title", "div #title",
                "ul.toc li.tocline2", "ul.toc > li.tocline2", "h1#title + div > p", "h1[id]:contains(Selectors)", "a[href][lang][class]",
                "div[class]", "div[class=example]", "div[class^=exa]", "div[class$=mple]", "div[class*=e]", "div[class|=dialog]",
                "div[class!=made_up]", "div[class~=example]", "div:not(.example)", "p:contains(selectors)", "p:nth-child(even)",
                "p:nth-child(2n)", "p:nth-child(odd)", "p:nth-child(2n+1)", "p:nth-child(n)", "p:only-child", "p:last-child", "p:first-child");

            try
            {
                test.LoadFromUrl("http://mootools.net/slickspeed/system/template.php");
            }
            catch (AggregateException)
            {
                Console.WriteLine();
                Console.WriteLine("Could not load the document from the given URL, switching to local version . . .");
                test.LoadFromSource(HtmlFiles.W3C);
            }

            test.Run();

            //test.Show("div > p");

            /*
            ***************************************************  final time should be between 12 and 407 ms  ***************************************************
            body	                        0 ms | 1 found	    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
            div	                            1 ms | 51 found	    1 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found
            body div	                    1 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    0 ms | 51 found	    2 ms | 51 found	    1 ms | 51 found
            div p	                        2 ms | 140 found	1 ms | 140 found	0 ms | 140 found	0 ms | 140 found	3 ms | 140 found	1 ms | 140 found
            div > p	                        2 ms | 134 found	1 ms | 134 found	0 ms | 134 found	0 ms | 134 found	2 ms | 134 found	1 ms | 134 found
            div + p	                        2 ms | 22 found	    0 ms | 22 found	    0 ms | 22 found	    0 ms | 22 found	    3 ms | 22 found	    1 ms | 22 found
            div ~ p	                        3 ms | 183 found	1 ms | 183 found	1 ms | 183 found	1 ms | 183 found	4 ms | 183 found	1 ms | 183 found
            div[class^=exa][class$=mple]	2 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    2 ms | 43 found	    1 ms | 43 found
            div p a	                        3 ms | 12 found	    1 ms | 12 found	    1 ms | 12 found	    0 ms | 12 found	    5 ms | 12 found	    1 ms | 12 found
            div, p, a	                    3 ms | 671 found    3 ms | 671 found	1 ms | 671 found	1 ms | 671 found	8 ms | 671 found	1 ms | 671 found
            .note	                        5 ms | 14 found	    1 ms | 14 found	    1 ms | 14 found	    0 ms | 14 found	    5 ms | 14 found	    1 ms | 14 found
            div.example	                    1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
            ul .tocline2	                2 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    9 ms | 12 found	    0 ms | 12 found
            div.example, div.note	        2 ms | 44 found	    1 ms | 44 found	    0 ms | 44 found	    0 ms | 44 found	    4 ms | 44 found	    0 ms | 44 found
            #title	                        1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
            h1#title	                    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 0 found
            div #title	                    1 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found	    1 ms | 1 found
            ul.toc li.tocline2	            1 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    2 ms | 12 found	    1 ms | 12 found
            ul.toc > li.tocline2	        1 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    0 ms | 12 found	    1 ms | 12 found	    1 ms | 12 found
            h1#title + div > p	            0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    2 ms | 0 found	    0 ms | 0 found
            h1[id]:contains(Selectors)	    1 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found	    1 ms | 1 found	    0 ms | 1 found	    1 ms | 1 found
            a[href][lang][class]	        2 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    0 ms | 1 found	    3 ms | 1 found	    1 ms | 1 found
            div[class]	                    1 ms | 51 found	    0 ms | 51 found	    0 ms | 51 found	    0 ms | 51 found	    1 ms | 51 found	    1 ms | 51 found
            div[class=example]	            2 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found
            div[class^=exa]	                1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
            div[class$=mple]	            1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
            div[class*=e]	                1 ms | 50 found	    0 ms | 50 found	    0 ms | 50 found	    0 ms | 50 found	    1 ms | 50 found	    1 ms | 50 found
            div[class|=dialog]	            0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    0 ms | 0 found	    1 ms | 0 found
            div[class!=made_up]	            1 ms | 51 found	    2 ms | 51 found	    2 ms | 51 found	    2 ms | 51 found	    1 ms | 51 found	    1 ms | 0 found
            div[class~=example]	            1 ms | 43 found	    1 ms | 43 found	    0 ms | 43 found	    0 ms | 43 found	    1 ms | 43 found	    1 ms | 43 found
            div:not(.example)	            1 ms | 8 found	    0 ms | 8 found	    0 ms | 8 found	    0 ms | 8 found	    5 ms | 8 found	    0 ms | 8 found
            p:contains(selectors)	        3 ms | 54 found	    3 ms | 54 found	    4 ms | 54 found	    3 ms | 54 found	    3 ms | 54 found	    1 ms | 57 found
            p:nth-child(even)	            5 ms | 158 found	1 ms | 158 found	1 ms | 158 found	0 ms | 158 found	39 ms | 158 found	1 ms | 158 found
            p:nth-child(2n)	                4 ms | 158 found	1 ms | 158 found	0 ms | 158 found	1 ms | 158 found	44 ms | 158 found	1 ms | 158 found
            p:nth-child(odd)	            4 ms | 166 found	1 ms | 166 found	0 ms | 166 found	0 ms | 166 found	44 ms | 166 found	1 ms | 166 found
            p:nth-child(2n+1)	            3 ms | 166 found	1 ms | 166 found	1 ms | 166 found	1 ms | 166 found	41 ms | 166 found	1 ms | 166 found
            p:nth-child(n)	                3 ms | 324 found	1 ms | 324 found	1 ms | 324 found	1 ms | 324 found	43 ms | 324 found	1 ms | 324 found
            p:only-child	                2 ms | 3 found	    0 ms | 3 found	    0 ms | 3 found	    0 ms | 3 found	    41 ms | 3  found	1 ms | 3 found
            p:last-child	                2 ms | 19 found	    1 ms | 19 found	    0 ms | 19 found	    0 ms | 19 found	    41 ms | 19 found	0 ms | 19 found
            p:first-child	                2 ms | 54 found	    1 ms | 54 found	    0 ms | 54 found	    1 ms | 54 found	    41 ms | 54 found	1 ms | 54 found
             */
        }