Ejemplo n.º 1
0
        public void TestNoProtoclNavigateSubmit()
        {
            BrowserStandard browser = new BrowserStandard();

            browser.Navigate("google.com");
            browser.Navigate("google.com", null);
            browser.Navigate("google.com", null, null);
            browser.Submit("google.com");
            browser.Submit("google.com", null);
            browser.Submit("google.com", null, null);
        }
Ejemplo n.º 2
0
        public void TestSubmitHeaders()
        {
            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 = browser.Submit(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);
            }
        }
Ejemplo n.º 3
0
        public void TestSubmit()
        {
            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 = browser.Submit("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"));
        }