internal static async Task <WebPage> Create(MechanizeBrowser Browser, WebPageRequestInfo RequestInfo) { var page = new WebPage(Browser, RequestInfo); await page.LoadAsync(); return(page); }
/// <summary> /// Navigates to a new Web Page, given the provided Request Information. /// </summary> /// <param name="Info">Request Information.</param> /// <returns>Navigated Web Page.</returns> public async Task <WebPage> NavigateAsync(WebPageRequestInfo Info) { if (CurrentPage?.RequestInfo?.UpdateHistory == true) { _History.Add(CurrentPage); } CurrentPage = await WebPage.Create(this, Info); return(CurrentPage); }
/// <summary> /// Submits the Form, with the provided submit button as the target. /// </summary> /// <param name="SubmitButton">Button to Submit with, if Required.</param> /// <returns></returns> public Task <WebPage> SubmitForm(SubmitControl SubmitButton) { var address = new Uri(Action, UriKind.RelativeOrAbsolute); // Attaches the Absolute address from the current page, if the address isn't already absolute. if (!address.IsAbsoluteUri) { address = new Uri(SourcePage.RequestInfo.Address, address); } var data = GetSubmissionData(SubmitButton); // Populates the Web Page Request to Navigate the Browser along. var requestInfo = new WebPageRequestInfo( address, data, Method.ToUpper(), EncodingType); return(SourcePage.SourceBrowser.NavigateAsync(requestInfo)); }
private WebPage(MechanizeBrowser Browser, WebPageRequestInfo RequestInfo) { SourceBrowser = Browser; this.RequestInfo = RequestInfo; }