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


C# Browser.GoTo方法代码示例

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


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

示例1: PageCanValidateAgainstMultipleLocationsTest

 public void PageCanValidateAgainstMultipleLocationsTest()
 {
     using (var browser = new Browser())
     {
         browser.GoTo<HomeIndexPage>(new Uri(Config.BaseWebAddress, "home/index/"));
         browser.GoTo<HomeIndexPage>(new Uri(Config.BaseWebAddress, "home/index"));
         browser.GoTo<HomeIndexPage>(new Uri(Config.BaseWebAddress, "/"));
         browser.GoTo<HomeIndexPage>();
     }
 }
开发者ID:roryprimrose,项目名称:Headless,代码行数:10,代码来源:LocationTests.cs

示例2: DropDownOnPageModelTest

        public void DropDownOnPageModelTest()
        {
            var testValues = new[]
            {
                string.Empty, "First", "Second", "Third", "Fourth", "Fifth"
            };

            using (var browser = new Browser())
            {
                var page = browser.GoTo<FormByGetPage>();

                page.Result.TraceResults();

                page.DropDown.Values.SequenceEqual(testValues).Should().BeTrue();

                page.DropDown.Value.Should().BeNullOrEmpty();

                for (var index = 0; index < testValues.Length; index++)
                {
                    page.DropDown.Value = testValues[index];

                    page = page.Submit.Click<FormByGetPage>();

                    page.DropDown.Value.Should().Be(testValues[index]);
                }

                page.DropDown.Value = null;

                page = page.Submit.Click<FormByGetPage>();

                page.DropDown.Value.Should().BeNullOrEmpty();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:33,代码来源:FormByGetTests.cs

示例3: PageReturnsLoadedPageOnSuccessfulRequestTest

        public void PageReturnsLoadedPageOnSuccessfulRequestTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo<HomeIndexPage>();

                browser.Page.Should().Be(page);
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:9,代码来源:BrowserTests.cs

示例4: BrowserCorrectlyValidatesNon200StatusCodeResponseTest

        public void BrowserCorrectlyValidatesNon200StatusCodeResponseTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo(Home.Failure, HttpStatusCode.InternalServerError);

                ((IHtmlPage)page).Result.TraceResults();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:9,代码来源:FailureTests.cs

示例5: BrowserThrowsHttpOutcomeExceptionWhenNoServerConnectionMadeTest

        public void BrowserThrowsHttpOutcomeExceptionWhenNoServerConnectionMadeTest()
        {
            using (var browser = new Browser())
            {
                Action action = () => browser.GoTo(new Uri("http://localhost:3377"));

                action.ShouldThrow<HttpOutcomeException>().Where(y => RenderException(y));
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:9,代码来源:FailureTests.cs

示例6: CanReadPageWithoutBodyTest

        public void CanReadPageWithoutBodyTest()
        {
            using (var browser = new Browser())
            {
                var location = new Uri("https://cashbank.cashedge.com/cashedgeBank/CashedgeBankSite/LoginPage.jsp");

                // This method will already test a 200 response and whether the document could be loaded
                browser.GoTo(location);
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:10,代码来源:LooseHtmlTests.cs

示例7: DynamicReturnsBinaryPageForBinaryMediaTypeTest

        public void DynamicReturnsBinaryPageForBinaryMediaTypeTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo(Content.BinaryTest) as BinaryPage;

                page.Should().NotBeNull();

                browser.Page.Should().BeSameAs(page);
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:DynamicPageTests.cs

示例8: CanReadTextPageUsingModelTest

        public void CanReadTextPageUsingModelTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo<TextContentPage>(Content.TextTest);

                page.Result.TraceResults();

                page.Content.Should().Be("This is a test text file");
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:TextPageTests.cs

示例9: DynamicPageDoesNotValidationFinalLocationAgainstOriginalRequestTest

        public void DynamicPageDoesNotValidationFinalLocationAgainstOriginalRequestTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo(Redirect.Temporary);

                bool actual = page.IsOn(Home.About);

                actual.Should().BeTrue();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:DynamicPageTests.cs

示例10: CanCloneIHtmlPageAsPageModelTest

        public void CanCloneIHtmlPageAsPageModelTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo<RedirectIndexPage>(Redirect.Index) as IHtmlPage;

                var redirectPage = page.CloneAs<RedirectIndexPage>();

                redirectPage.External.Click();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:PageCloneAsTests.cs

示例11: CanReadTextPageUsingDynamicTest

        public void CanReadTextPageUsingDynamicTest()
        {
            using (var browser = new Browser())
            {
                var page = (TextPage)browser.GoTo(Content.TextTest);

                page.Result.TraceResults();

                page.Content.Should().Be("This is a test text file");
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:TextPageTests.cs

示例12: GoToThrowsExceptionWhenTimeoutExpiredTest

        public void GoToThrowsExceptionWhenTimeoutExpiredTest()
        {
            using (var browser = new Browser())
            {
                browser.Timeout = TimeSpan.FromMilliseconds(10);

                Action action = () => browser.GoTo(new Uri("https://google.com"));

                action.ShouldThrow<TimeoutException>();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:BrowserTests.cs

示例13: PageReturnsLoadedPageWhenHttpOutcomeFailsTest

        public void PageReturnsLoadedPageWhenHttpOutcomeFailsTest()
        {
            using (var browser = new Browser())
            {
                Action action = () => browser.GoTo(Redirect.Index, HttpStatusCode.BadRequest);

                action.ShouldThrow<HttpOutcomeException>();

                browser.Page.Should().NotBeNull();
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:BrowserTests.cs

示例14: DynamicReturnsIHtmlPageForHtmlMediaTypeTest

        public void DynamicReturnsIHtmlPageForHtmlMediaTypeTest()
        {
            using (var browser = new Browser())
            {
                var page = browser.GoTo(Redirect.Index) as IHtmlPage;

                page.Should().NotBeNull();

                browser.Page.Should().BeSameAs(page);
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:11,代码来源:DynamicPageTests.cs

示例15: NavigateToSignup

 public void NavigateToSignup(Browser browser)
 {
     if (browser.Link(Find.ByText("Sign Out")).Exists)
     {
         SignOut si = new SignOut();
         si.UserSignOut(browser);
     }
     browser.GoTo(targetHost);
     //browser.Link(Find.ById("ctl00_ctl00_uxPreContent_uxTopNavigation_uxMemberLoginStatus_uxMemberLoginView_uxMemberSignUpLink")).Click();
     browser.Link(Find.ById("uxMemberSignUpLink")).Click();
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:11,代码来源:SignUp.cs


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