public void When_Testing_Referer_Unsafe_Url_Secure_Transition()
        {
            string startingUrl = "https://www.codeproject.com/";

            Browser b = new Browser();

            b.RefererMode = Browser.RefererModes.UnsafeUrl;
            Assert.AreEqual(b.RefererMode, Browser.RefererModes.UnsafeUrl);

            bool success = b.Navigate(startingUrl);

            Assert.IsTrue(success);
            Assert.IsNotNull(b.CurrentState);
            Assert.IsNull(b.Referer);

            HtmlResult link = b.Find("ctl00_AdvertiseLink");

            Assert.IsNotNull(link);

            link.XElement.SetAttributeValue("href", "http://afn.org/~afn07998/simplebrowser/testmeta.htm");
            string targetHref = link.GetAttribute("href");

            Assert.AreEqual(targetHref, "http://afn.org/~afn07998/simplebrowser/testmeta.htm");

            link.Click();
            Assert.IsNotNull(b.CurrentState);
            Assert.IsNotNull(b.Referer);
            Assert.AreEqual(b.Referer.ToString(), startingUrl);
        }
        public void GetAttribute_Backdoor_FrameHandle()
        {
            Browser        b           = new Browser(Helper.GetFramesMock());
            HttpRequestLog lastRequest = null;

            b.RequestLogged += (br, l) =>
            {
                lastRequest = l;
            };
            b.Navigate("http://localhost/");
            HtmlResult elm    = b.Select("iframe");
            string     handle = elm.GetAttribute("SimpleBrowser.WebDriver:frameWindowHandle");

            Assert.AreEqual(handle, "frame1");
        }
Example #3
0
 public string GetAttribute(string attributeName)
 {
     return(_htmlResult.GetAttribute(attributeName));
 }