private Automation.Core.Browser getCurrentBrowser()
        {
            switch (_browserType)
            {
            case API.Enumerations.BrowserType.InternetExplorer:
                // TODO: Calculate browser chrome height/width so we don't need fullscreen mode
                Automation.Core.IE browser = new Automation.Core.IE(true);
                ((SHDocVw.WebBrowser)browser.InternetExplorer).FullScreen = true;

                // setup handler
                browser.AddDialogHandler(new JavaScriptAlertDialogHandler(s => this._alertDialogMessages.Add(s)));
                browser.DialogWatcher.CloseUnhandledDialogs = true;
                browser.AutoClose = true;

                return(browser);

            case API.Enumerations.BrowserType.Firefox:
                throw new NotImplementedException("WatiN only supports Firefox with JSSH enabled. JSSH is not supported on versions newer than 4.0 so it has been disabled via this API.");

            default:
                throw new NotImplementedException("WatiN only supports Internet Explorer. Switch to Selenium if you want to target other browsers.");
            }
        }
Ejemplo n.º 2
0
        private Automation.Core.Browser getCurrentBrowser()
        {
            switch (_browserType)
            {
                case API.Enumerations.BrowserType.InternetExplorer:
                    // TODO: Calculate browser chrome height/width so we don't need fullscreen mode
                    Automation.Core.IE browser = new Automation.Core.IE(true);
                    ((SHDocVw.WebBrowser)browser.InternetExplorer).FullScreen = true;

                    // setup handler
                    var dialogHandler = new JavaScriptAlertDialogHandler(s => this._alertDialogMessages.Add(s));
                    this._dialogHandlers.Add(dialogHandler);
                    browser.AddDialogHandler(dialogHandler);
                    browser.DialogWatcher.CloseUnhandledDialogs = true;
                    browser.AutoClose = true;

                    return browser;
                case API.Enumerations.BrowserType.Firefox:
                    throw new NotImplementedException("WatiN only supports Firefox with JSSH enabled. JSSH is not supported on versions newer than 4.0 so it has been disabled via this API.");
                default:
                    throw new NotImplementedException("WatiN only supports Internet Explorer. Switch to Selenium if you want to target other browsers.");
            }
        }