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


C# IE.GoTo方法代码示例

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


在下文中一共展示了IE.GoTo方法的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: SetUp

 public void SetUp()
 {
     Settings.WaitForCompleteTimeOut = 10;
     Settings.WaitUntilExistsTimeOut = 10;
     ie = new IE();
     ie.GoTo(url + "ProspectorPlus/VendorLogin.aspx");
     ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:8,代码来源:TestBase.cs

示例3: RegisterStandardTestUser

        /// <summary>
        /// Registers the standard test user.
        /// </summary>
        /// <param name="browser">The <paramref name="browser"/> instance.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns>
        /// If User was Registered or not
        /// </returns>
        public static bool RegisterStandardTestUser(IE browser, string userName, string password)
        {
            browser.GoTo("{0}yaf_register.aspx".FormatWith(TestConfig.TestForumUrl));

            var email = "{0}@test.com".FormatWith(userName.ToLower());

            browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            // Check if Registrations are Disabled
            if (browser.ContainsText("You tried to enter an area where you didn't have access"))
            {
                return false;
            }

            // Accept the Rules
            if (browser.ContainsText("Forum Rules"))
            {
                browser.Button(Find.ById("forum_ctl04_Login1_LoginButton")).Click();
                browser.Refresh();
            }

            if (browser.ContainsText("Security Image"))
            {
                return false;
            }

            // Fill the Register Page
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_UserName"))).TypeText(
                userName);

            if (browser.ContainsText("Display Name"))
            {
                browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_DisplayName"))).TypeText(userName);
            }

            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Password"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_ConfirmPassword"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Email"))).TypeText(email);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Question"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Answer"))).TypeText(password);

            ////browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_tbCaptcha"))).TypeText(captcha);

            // Create User
            browser.Button(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_StepNextButton"))).Click();

            if (!browser.ContainsText("Forum Preferences"))
            {
                return false;
            }

            browser.Button(Find.ById(new Regex("ProfileNextButton"))).Click();

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

示例4: MyTestInitialize

        public void MyTestInitialize()
        {
            IISManager.KillW3WP();
             DatabaseManager.DropDatabase(TestEnvironment.DatabaseName);
             DatabaseManager.CopyAndAttachDatabase(TestContext, TestEnvironment.DatabaseName);

             // Open a new Internet Explorer window and navigate to the website
             ie = new IE();
             ie.GoTo(TestEnvironment.PortalUrl);

             Login(TestUsers.Admin.UserName, TestUsers.Admin.Password, TestUsers.Admin.DisplayName);
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:12,代码来源:ControlPanelTests.cs

示例5: 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

示例6: OpenIEInstance

        /// <summary>
        /// Opens a new IE instance with the given settings in front of other windows that are currently open.
        /// </summary>
        /// <param name="targetURL">The URL that the IE instance should browse to.</param>
        /// <param name="silentMode">If true the test will be run without displaying any IE instance or steps.</param>
        /// <param name="timeOut">The default time out to use when calling IE.AttachToIE(findby).</param>
        /// <param name="autoCloseIE">If true when a reference to the IE instance is destroyed the actual window will close.</param>
        /// <param name="movePointer">It true the mouse pointer will move to the top left corner of the screen when a new IE instance is created.</param>
        /// <returns>The new IE instance.</returns>
        public static IE OpenIEInstance(string targetURL, bool silentMode, int timeOut, bool autoCloseIE, bool movePointer)
        {
            Settings.MakeNewIeInstanceVisible = !silentMode;
            Settings.WaitForCompleteTimeOut = timeOut;
            Settings.WaitUntilExistsTimeOut = timeOut;
            Settings.AttachToBrowserTimeOut = timeOut;
            Settings.AutoMoveMousePointerToTopLeft = movePointer;

            IE ieInstance = new IE { AutoClose = autoCloseIE };
            if(!silentMode) ieInstance.ShowWindow(NativeMethods.WindowShowStyle.ShowMaximized);
            ieInstance.BringToFront();
            ieInstance.GoTo(targetURL);

            return ieInstance;
        }
开发者ID:biganth,项目名称:Curt,代码行数:24,代码来源:WatiNUtil.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: 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

示例9: Adding_Items_ToCart

        public void Adding_Items_ToCart()
        {
            using (var browser = new IE())
            {
                browser.GoTo("http://localhost:1100/");

                browser.BringToFront();

                browser.Link(Find.ByText("Pop")).Click();

                browser.Link(Find.ByText("Frank")).Click();

                browser.Link(Find.ByText("Add to cart")).Click();

                Assert.IsTrue(browser.ContainsText("8.99"));
            }
        }
开发者ID:giozom,项目名称:ODNC-WatiN-And-SpecFlow-Demo-Code,代码行数:17,代码来源:CartTests.cs

示例10: WatinOverview

        public void WatinOverview()
        {
            using (var ie = new IE())
            {
                ie.BringToFrontForDemo();
                ie.AutoClose = false;

                // Navigate
                ie.GoTo("http://localhost:62988/Register.aspx");

                // Finding a HTML element by id
                var passwordTextBox = ie.TextField(Find.ById("Password"));

                // Typing text
                passwordTextBox.TypeText("Hello World");

                // Clicking a button
                ie.Button(Find.ById("DoRegister")).Click();
            }
        }
开发者ID:syedshah,项目名称:SpecFlow,代码行数:20,代码来源:SimpleOverview.cs

示例11: Demonstrate_speed

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

            var url = "http://localhost:1234/";
            using (var ie = new IE(url))
            {
                for (int i = 0; i < 50; i++)
                {
                    ie.GoTo("http://localhost:1234/");
                    ie.TextField("PathAndQuerystring").Value = "/MyUrl";
                    ie.TextField("LoginName").Value = "SomeComputer\\ThisUser";
                    ie.Button("submit").Click();

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

示例12: DeletePostByTitle

        public bool DeletePostByTitle(string title, IE ie)
        {
            ie.GoTo(Url);
            ie.WaitForComplete();

            var tblPosts = ie.Table("Posts");

            if (tblPosts != null)
            {
                foreach (var row in tblPosts.TableRows)
                {
                    if (!string.IsNullOrEmpty(row.Id) && row.InnerHtml.Contains(title))
                    {
                        ie.Link("a-" + row.Id).Click();
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:royosherove,项目名称:tddnetcoursedemos,代码行数:20,代码来源:PostList.cs

示例13: RemoveItemsFromCart

        public void RemoveItemsFromCart()
        {
            using (var browser = new IE())
            {
                browser.GoTo("http://localhost:1100/");

                browser.BringToFront();

                browser.Link(Find.ByText("Pop")).Click();

                browser.Link(Find.ByText("Frank")).Click();

                browser.Link(Find.ByText("Add to cart")).Click();

                browser.Link(Find.BySelector("a.RemoveLink")).Click();

                Assert.IsTrue(browser.ContainsText("0"));

            }
        }
开发者ID:giozom,项目名称:ODNC-WatiN-And-SpecFlow-Demo-Code,代码行数:20,代码来源:CartTests.cs

示例14: Register

        public void Register()
        {
            try
            {
                Ie = new IE("about:blank");
                Ie.GoTo("http://localhost/GuestBook/GuestBook.aspx");
                Ie.TextField(Find.ByName("name")).TypeText("Jay");
                Ie.TextField(Find.ByName("comments")).TypeText("Hello");
                Ie.Button(Find.ByName("save")).Click();

                Assert.AreEqual("Jay", Ie.TableCell(Find.By("innerText", "Jay")).Text, @"innerText does not match");
                Assert.AreEqual("Hello", Ie.TableCell(Find.By("innerText", "Hello")).Text, @"innerText does not match");
            }
            finally
            {
                if (Ie != null)
                {
                    InternetExplorer internetExplorer = (InternetExplorer)Ie.InternetExplorer;
                    internetExplorer.Quit();
                }
            }
        }
开发者ID:vardars,项目名称:ci-factory,代码行数:22,代码来源:Register.cs

示例15: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                IE ie = new IE();

                ie.GoTo("www.terra.com.br");

                ie.WaitForComplete();

                ie.TextField("autocomplete").Value = "esporte";
                ie.TextField("autocomplete").Focus();

                SendKeys.SendWait("{ENTER}");
                //ie.TextField("autocomplete").KeyPress((char)Keys.Enter);

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
开发者ID:Willamar,项目名称:Projetos,代码行数:23,代码来源:Form1.cs


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