public async Task TestNoProtoclNavigateSubmitAsync() { BrowserStandard browser = new BrowserStandard(); await browser.NavigateAsync("google.com"); await browser.NavigateAsync("google.com", null); await browser.NavigateAsync("google.com", null, null); await browser.SubmitAsync("google.com"); await browser.SubmitAsync("google.com", null); await browser.SubmitAsync("google.com", null, null); }
public async Task TestSubmitAsyncHeaders() { BrowserStandard browser = new BrowserStandard(); Dictionary <string, string> formData = new Dictionary <string, string>(); formData.Add("Username", "FakeUserName"); formData.Add("Password", "FakePassword123"); formData.Add("SecretMessage", "This is a secret message"); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("x-csrf-token", "axsd82os21"); var response = await browser.SubmitAsync(RequestTesterRouteUri, formData, headers); foreach (var data in formData) { Assert.AreEqual(data.Value, response.HtmlDocument.QuerySelector("#" + data.Key).TextContent); } foreach (var header in headers) { Assert.AreEqual(header.Value, response.HtmlDocument.QuerySelector("#" + header.Key).TextContent); } }
public async Task TestSubmitAsync() { BrowserStandard browser = new BrowserStandard(); Dictionary <string, string> formData = new Dictionary <string, string>(); formData.Add("Username", "FakeUserName"); formData.Add("Password", "FakePassword123"); formData.Add("SecretMessage", "This is a secret message"); var response = await browser.SubmitAsync("https://www.hashemian.com/tools/form-post-tester.php", formData); Assert.True(response.Response.Content.Contains("Username=FakeUserName")); Assert.True(response.Response.Content.Contains("Password=FakePassword123")); Assert.True(response.Response.Content.Contains("SecretMessage=This%20is%20a%20secret%20message")); var response2 = browser.Documents[0]; Assert.True(response2.Response.Content.Contains("Username=FakeUserName")); Assert.True(response2.Response.Content.Contains("Password=FakePassword123")); Assert.True(response2.Response.Content.Contains("SecretMessage=This%20is%20a%20secret%20message")); }