Beispiel #1
0
        public void BrowserWindowTest_BackShouldLeadToPreviousUri()
        {
            BrowserWindow.NavigateToUrl(_basicTestPageUrl);
            var currentUri = BrowserWindow.Uri;

            BrowserWindow.NavigateToUrl(_mouseTestPageUrl);
            BrowserWindow.Back();

            BrowserWindow
            .Uri
            .ShouldBeEquivalentTo(currentUri, "because back should return to the previous page.");
        }
Beispiel #2
0
        public void BrowserWindowTest_ForwardShouldUndoBack()
        {
            BrowserWindow.NavigateToUrl(_basicTestPageUrl);

            BrowserWindow.NavigateToUrl(_mouseTestPageUrl);
            BrowserWindow
            .Uri
            .ShouldBeEquivalentTo(_mouseTestPageUrl, "because browser should have been redirected to '{0}'.", _mouseTestPageUrl);

            BrowserWindow.Back();
            BrowserWindow
            .Uri
            .ShouldBeEquivalentTo(_basicTestPageUrl, "because back should redirect browser to '{0}'.", _basicTestPageUrl);

            BrowserWindow.Forward();
            BrowserWindow
            .Uri
            .ShouldBeEquivalentTo(_mouseTestPageUrl, "because forward should undo back.");
        }
Beispiel #3
0
        public void BrowseWindow_Hook() //Video no 17
        {
            //hook with already existing Browser with title "Execute Automation"
            BrowserWindow window = BrowserWindow.Locate("Execute Automation"); //Execute Automation is the title of the browser.

            //From Process
            //BrowserWindow fromProcess = BrowserWindow.FromProcess();

            BrowserWindow.ClearCookies();
            BrowserWindow.ClearCache();

            Image image = window.CaptureImage();

            image.Save(@"c:\captured.jpeg", ImageFormat.Jpeg);
            image.Dispose();                          //Releasing

            BrowserWindow.CurrentBrowser = "Firefox"; // or "Chrome" or "IE"

            window.Refresh();

            window.Forward();
            window.Back();
            window.NavigateToHomepage();
        }