当前位置: 首页>>代码示例>>C#>>正文


C# IE.TextField方法代码示例

本文整理汇总了C#中WatiN.Core.IE.TextField方法的典型用法代码示例。如果您正苦于以下问题:C# IE.TextField方法的具体用法?C# IE.TextField怎么用?C# IE.TextField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WatiN.Core.IE的用法示例。


在下文中一共展示了IE.TextField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginUser

        /// <summary>
        /// Logins the user.
        /// </summary>
        /// <param name="browser">The <paramref name="browser"/> instance.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="userPassword">The user password.</param>
        /// <returns>If User login was successfully or not</returns>
        public static bool LoginUser(IE browser, string userName, string userPassword)
        {
            // Login User
            browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));

            // Check If User is already Logged In
            if (browser.Link(Find.ById(new Regex("_LogOutButton"))).Exists)
            {
                browser.Link(Find.ById("forum_ctl01_LogOutButton")).Click();

                browser.Button(Find.ById("forum_ctl02_OkButton")).Click();
            }

            browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));

            browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            browser.TextField(Find.ById(new Regex("Login1_UserName"))).TypeText(userName);
            browser.TextField(Find.ById(new Regex("Login1_Password"))).TypeText(userPassword);

            browser.Button(Find.ById(new Regex("LoginButton"))).ClickNoWait();

            browser.GoTo(TestConfig.TestForumUrl);

            return browser.Link(Find.ById(new Regex("LogOutButton"))).Exists;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:33,代码来源:TestHelper.cs

示例2: FetchEvents

        /// <summary>
        /// Screen Scrape Events
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        static List<EventDetail> FetchEvents(string query)
        {
            var eventDetails = new List<EventDetail>();
            using (var _browser = new IE("http://www.gettyimages.com", false))
            {
                _browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);
                _browser.TextField(Find.ById("txtPhrase")).Clear();
                _browser.TextField(Find.ById("txtPhrase")).TypeText(query);
                var editorialChkfield = _browser.CheckBox(Find.ById("cbxEditorial"));

                if (!editorialChkfield.Checked)
                    editorialChkfield.Click();

                _browser.Button(Find.ById("btnSearch")).Click();

                if (_browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Exists)
                {
                    _browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Click();
                    _browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent")).WaitUntilExists();

                    var filterContentDiv = _browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent"));

                    foreach (var link in filterContentDiv.Links.Filter(Find.ByClass("refineItem")))
                    {
                        var splitList = link.OuterHtml.Split('\'');

                        if (splitList.Length > 5)
                            eventDetails.Add(new EventDetail() { EventId = int.Parse(splitList[1]), EventName = splitList[5].Trim() });
                    }
                }
            }

            return eventDetails;
        }
开发者ID:karthik20522,项目名称:EventViewer,代码行数:39,代码来源:Program.cs

示例3: Login

 protected void Login(IE ie)
 {
     TextField tf = ie.TextField(Find.ByName(t => t.EndsWith("$UserName")));
     if (!tf.Exists) return; //already logged
     tf.TypeText("Alkampfer");
     ie.TextField(Find.ByName(t => t.EndsWith("$Password"))).TypeText("12345");
     ie.Button(Find.ByName(b => b.EndsWith("$LoginButton"))).Click();
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:8,代码来源:WatinBase.cs

示例4: Authorize

 public Browser Authorize(string login, string password)
 {
     Browser browser = new IE("https://www.codeplex.com/site/login");
     
     browser.GoTo("https://www.codeplex.com/site/login");
     browser.Link("CodePlexLogin").Click();
     browser.TextField("UserName").TypeText(login);
     browser.TextField("Password").TypeText(password);
     browser.Button("loginButton").Click();
     
     return browser;
 }
开发者ID:G-IT-ED,项目名称:vk,代码行数:12,代码来源:CodeplexAuthorization.cs

示例5: Should_save_a_visit

        public void Should_save_a_visit()
        {
            new DatabaseTester().Clean();

            var url = "http://localhost:1234/";
            using (var ie = new IE(url))
            {
                ie.TextField("PathAndQuerystring").TypeText("/MyUrl");
                ie.TextField("LoginName").TypeText("SomeComputer\\ThisUser");
                ie.Button("submit").Click();

                ie.ContainsText("/MyUrl");
                ie.ContainsText("SomeComputer\\ThisUser").ShouldBeTrue();
            }
        }
开发者ID:jbasilio,项目名称:IterationZero,代码行数:15,代码来源:HomeControllerTester.cs

示例6: LocatingThings

        public void LocatingThings()
        {
            using (var browser =
                new IE("http://www.pluralsight.com"))
            {
                //// Get a reference to a HTML input element, type=text, id=Name
                //TextField applicantName = browser.TextField(Find.ById("Name"));

                //// Get a reference to a HTML link element with id=HelpLink
                //Link helpHyperlink = browser.Link(Find.ById("HelpLink"));

                //// Get a reference to a HTML input element, type=submit, id=ApplyNow
                //Button applyButton = browser.Button(Find.ById("ApplyNow"));

                //// Get a reference to a HTML paragraph element, id=Name
                //Para nameParagraph = browser.Para(Find.ById("Name"));

            TextField applicantName = browser.TextField(Find.ById("Name"));

            Link helpHyperlink = browser.Link(Find.ById("HelpLink"));

            Button applyButton = browser.Button(Find.ById("ApplyNow"));

            Para nameParagraph = browser.Para(Find.ById("Name"));
            }
        }
开发者ID:stephenosrajan,项目名称:PSTestingEndToEnd,代码行数:26,代码来源:DemoCodeForSlides.cs

示例7: Login

        public bool Login(string username, string password)
        {
            ie = new IE();

            ie.GoTo("http://www.cruisecontrolnet.org/login");
            if (!AtChiliCCNet()) return false;

            ie.TextField(WatiN.Core.Find.ByName("username")).SetAttributeValue("value", username);

            ie.TextField(WatiN.Core.Find.ByName("password")).SetAttributeValue("value", password);
            ie.Button(WatiN.Core.Find.ByName("login")).Click();

            if (ie.Elements.Exists("password")) return false; // still on logon page, so login failed

            return true;
        }
开发者ID:kpartusch,项目名称:CruiseControl.NET,代码行数:16,代码来源:ChiliAutomation.cs

示例8: UnsuccessfulAdministrationLogin

        public void UnsuccessfulAdministrationLogin()
        {
            bool result;
            using (var browser = new IE("http://localhost:1200/"))
            {
                browser.Link(Find.ByText("Admin")).Click();
                browser.TextField(Find.ById("UserName")).TypeText("admin");
                browser.TextField(Find.ById("Password")).TypeText("admin");

                browser.Element(Find.ByValue("Log On")).Click();

                result = browser.ContainsText("Login was unsuccessful.");
            }

            Assert.That(result, "Browser Url is incorrect");
        }
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:16,代码来源:LoginTests.cs

示例9: SuccessfulAdministrationLogin

        public void SuccessfulAdministrationLogin()
        {
            var browserUrl = string.Empty;
            using (var browser = new IE("http://localhost:1200/"))
            {
                browser.Link(Find.ByText("Admin")).Click();
                browser.TextField(Find.ById("UserName")).TypeText("administrator");
                browser.TextField(Find.ById("Password")).TypeText("password123!");

                browser.Element(Find.ByValue("Log On")).Click();
                browser.WaitForComplete(2);

                browserUrl = browser.Url;
            }

            Assert.That(browserUrl.Contains("/StoreManager"), string.Format("Browser Url is incorrect - it is actually {0}", browserUrl));
        }
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:17,代码来源:LoginTests.cs

示例10: Login

        private void Login(ref IE ie)
        {
            Utilities.NavigateToHomePage(ref ie);

            if (ie.Url.Contains("Login"))
            {
                ie.GoTo(Utilities.GetUrl("Index.aspx"));

                string UserName = ConfigurationReader.getWebUserName();
                string Password = ConfigurationReader.getWebPassword();

                ie.TextField(Find.ById("txtUsername")).TypeText(UserName);
                ie.TextField(Find.ById("txtPassword")).TypeText(Password);

                ie.Image(Find.ById("IbLogin")).ClickNoWait();
            }
        }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:17,代码来源:IntegratedTestingBase.cs

示例11: SearchForWatiNOnGoogle

        public void SearchForWatiNOnGoogle()
        {
            using (var browser = new IE("http://www.google.com")) {
                browser.TextField(Find.ByName("q")).TypeText("WatiN");
                browser.Button(Find.ByName("btnG")).Click();

                Assert.IsTrue(browser.ContainsText("WatiN"));
            }
        }
开发者ID:robbytarigan,项目名称:HelloWorldWatin,代码行数:9,代码来源:UnitTest1.cs

示例12: AddPost_ShouldRenderAddForm_AndConfirmPostSaved

        public void AddPost_ShouldRenderAddForm_AndConfirmPostSaved()
        {
            using(IE browser = new IE(BuildTestUrl("post/add.aspx")))
            {
                Assert.IsTrue(browser.ContainsText("Ben Lovell's Blog"),
                    "No header text found");
                Assert.IsTrue(browser.ContainsText("Add Post"),
                    "Add Post not found");

                browser.TextField(Find.ByName("post.Title")).TypeText("Title");
                browser.TextField(Find.ByName("post.Description")).TypeText("Description");
                browser.TextField(Find.ByName("post.Content")).TypeText("Content");
                browser.Button(Find.ByValue("Submit")).Click();

                Assert.IsTrue(browser.ContainsText(@"The post titled: 'Title' was created!"),
                    "Correct confirmation was not displayed");
            }
        }
开发者ID:nshah55,项目名称:mr-blogengine,代码行数:18,代码来源:AddPostFixture.cs

示例13: RunSmokeTest

 public void RunSmokeTest()
 {
     using (var browser = new IE("http://www.google.com"))
     {
         const string search = "WatiN";
         browser.TextField(Find.ByName("q")).TypeText(search);
         browser.Button(Find.ByName("btnG")).Click();
         Assert.IsTrue(browser.ContainsText(search));
     }
 } 
开发者ID:Redabenmeradi,项目名称:cuke4ninja,代码行数:10,代码来源:SmokeTest.cs

示例14: HelloWatin

        public void HelloWatin(string search)
        {
            using (var browser = new IE("http://www.google.com"))
            {
                browser.TextField(Find.ByName("q")).TypeText(search);
                browser.Button(Find.ByName("btnG")).Click();

                Assert.IsTrue(browser.ContainsText(search));
            }
        }
开发者ID:Redabenmeradi,项目名称:cuke4ninja,代码行数:10,代码来源:SmokeTestSteps.cs

示例15: Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works

        public void Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works()
        {
            var result = false;
            using (IE netWindow = new IE("http://localhost:49573/default.aspx"))
            {
                LoginAsAdmin(netWindow);

                netWindow.Link(Find.ById("ctl00_ucHeader_lnkAdminPage")).Click();
                #region hidden new way
                netWindow.Link(Find.ById(new Regex("AdminPage$")));
                #endregion

                netWindow.WaitForComplete();

                netWindow.Button(Find.ById("ctl00_ucHeader_lnkProductAdmin")).Click();
                netWindow.WaitForComplete();

                netWindow.Button(Find.ById("ctl00_ContentPlaceHolder1_RadDock1_C_btnAddProduct")).Click();
                netWindow.WaitForComplete();

                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductName")).TypeText(String.Format("Paul Test Product {0}", DateTime.Now.Ticks.ToString()));
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlProductManufacturer")).SelectByValue("3");
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlCategoryList")).SelectByValue("2");
                netWindow.WaitForComplete(100);
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlSubCategoryList")).SelectByValue("2");
                netWindow.WaitForComplete();
                netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnAddCombo")).Click();
                netWindow.WaitForComplete();
                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductPrice")).TypeText("19.99");
                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductModel")).TypeText("Paul Test Model 1");
                netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnSave")).Click();

                netWindow.WaitForComplete();

                Span resultMessage = netWindow.Span(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ucMessage_lblMessage"));
                if (resultMessage.Text == "New Product created successfuly")
                {
                    result = true;
                }
            }
            Assert.IsTrue(result);
        }
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:42,代码来源:SampleTestsforWebforms.cs


注:本文中的WatiN.Core.IE.TextField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。