Example #1
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.");
        }
Example #2
0
        /// <summary>
        /// RecordedMethod2
        /// </summary>
        public void RecordedMethod2()
        {
            #region Variable Declarations
            HtmlHyperlink uIAboutHyperlink             = this.UIHomePageMyASPNETApplWindow.UIHomePageMyASPNETApplDocument.UIAboutHyperlink;
            HtmlHyperlink uIContactHyperlink           = this.UIHomePageMyASPNETApplWindow.UIAboutMyASPNETApplicaDocument.UIContactHyperlink;
            BrowserWindow uIHomePageMyASPNETApplWindow = this.UIHomePageMyASPNETApplWindow;
            #endregion

            // Click 'About' link
            Mouse.Click(uIAboutHyperlink, new Point(47, 28));

            // Click 'Contact' link
            Mouse.Click(uIContactHyperlink, new Point(56, 28));

            // Perform Forward on Browser Window
            uIHomePageMyASPNETApplWindow.Forward();

            // Perform Close on Browser Window
            uIHomePageMyASPNETApplWindow.Close();
        }
Example #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();
        }