本文整理汇总了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>();
}
}
示例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();
}
}
示例3: PageReturnsLoadedPageOnSuccessfulRequestTest
public void PageReturnsLoadedPageOnSuccessfulRequestTest()
{
using (var browser = new Browser())
{
var page = browser.GoTo<HomeIndexPage>();
browser.Page.Should().Be(page);
}
}
示例4: BrowserCorrectlyValidatesNon200StatusCodeResponseTest
public void BrowserCorrectlyValidatesNon200StatusCodeResponseTest()
{
using (var browser = new Browser())
{
var page = browser.GoTo(Home.Failure, HttpStatusCode.InternalServerError);
((IHtmlPage)page).Result.TraceResults();
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
示例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();
}
}
示例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();
}
}
示例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");
}
}
示例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>();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}