示例#1
0
        public void OpenTo(Action<HtmlDocument> configure)
        {
            var document = new HtmlDocument();
            configure(document);
            var fileName = "doc.htm";

            document.WriteToFile(fileName);

            OpenTo(fileName);
        }
        public void SetUp()
        {
            new FileSystem().DeleteFile("screenfixture.htm");

            var document = new HtmlDocument();
            configureDocument(document);

            document.WriteToFile("screenfixture.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }
        }
        public void SetUp()
        {
            var document = new HtmlDocument();
            document.Add(new HtmlTag("textarea", tag =>
                                                     {
                                                         tag.Id("textarea1");
                                                         tag.Text(theText);
                                                     })
                );

            document.WriteToFile("textarea.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }

            textarea1 = theDriver.FindElement(By.Id("textarea1"));
        }
        public void SetUp()
        {
            var document = new HtmlDocument();
            document.Add(new CheckboxTag(true).Id("checked"));
            document.Add(new CheckboxTag(false).Id("not-checked"));
            document.Add(new CheckboxTag(false).Attr("disabled", "disabled").Id("disabled"));
            document.Add(new CheckboxTag(true).Id("enabled"));
            document.Add(new CheckboxTag(false).Id("target1"));
            document.Add(new CheckboxTag(false).Id("target2"));
            document.Add(new CheckboxTag(true).Id("target3"));
            document.Add(new CheckboxTag(false).Id("target4"));
            document.Add(new DivTag("div1"));
            document.Add(new TextboxTag().Id("txt1"));

            document.WriteToFile("checkbox.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }
        }
        public void SetUp()
        {
            var document = new HtmlDocument();
            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", "2").Id("b");
                tag.Option("c", 3).Id("c");

                tag.SelectByValue("2");
            }).Name("select1").Id("select1"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");

            }).Name("select2").Id("select2"));

            document.Add(new SelectTag(tag =>
            {
                tag.Add("option").Text("a");
                tag.Add("option").Text("b").Attr("selected", "selected");
                tag.Add("option").Text("c");

            }).Name("select3").Id("select3"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");
                tag.Option("value", "b").Id("c");

                tag.SelectByValue(2);
            }).Name("select4").Id("select4"));

            document.WriteToFile("select.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }

            select1 = theDriver.FindElement(By.Id("select1"));
            nothingSelectedElement = theDriver.FindElement(By.Id("select2"));
            select3 = theDriver.FindElement(By.Id("select3"));
            select4 = theDriver.FindElement(By.Id("select4"));
        }