Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the Lynda.Test.Browsers.Browser class
        /// and opens a new browser window with the specified uri.
        /// </summary>
        /// <param name="product">The Lynda.Test.Browsers.Browser.BrowserProduct to open.</param>
        /// <param name="url">The default uri for the opened browser. If String.Empty then uri is the default uri for that browser.</param>
        /// <param name="killExisting">If TRUE, kills any open browser processes for the specified browser first.</param>
        public Browser(BrowserProduct product, string uri, bool killExisting)
        {
            if (product < BrowserProduct.IE || product > BrowserProduct.Safari)
            {
                throw new ArgumentOutOfRangeException("product", product, "Must be one of the following: IE, Firefox, Chrome or Safari");
            }
            browserProduct = product;

            switch (browserProduct)
            {
            case BrowserProduct.IE:
            {
                ieBrowser = new IEBrowser(uri, killExisting);
                break;
            }

            case BrowserProduct.Chrome:
            {
                chromeBrowser = new ChromeBrowser(uri, killExisting);
                break;
            }

            case BrowserProduct.Firefox:
            {
                firefoxBrowser = new FirefoxBrowser(uri, killExisting);
                break;
            }

            case BrowserProduct.Safari:
            {
                safariBrowser = new SafariBrowser(uri, killExisting);
                break;
            }

            default:
                throw new Exception(String.Format("Code not implemented yet: {0}", product.ToString()));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the Lynda.Test.Browsers.Browser class
        /// and opens a new browser window with the specified uri.
        /// </summary>
        /// <param name="product">The Lynda.Test.Browsers.Browser.BrowserProduct to open.</param>
        /// <param name="url">The default uri for the opened browser. If String.Empty then uri is the default uri for that browser.</param>
        /// <param name="killExisting">If TRUE, kills any open browser processes for the specified browser first.</param>
        public Browser(BrowserProduct product, string uri, bool killExisting)
        {
            if (product < BrowserProduct.IE || product > BrowserProduct.Safari)
            {
                throw new ArgumentOutOfRangeException("product", product, "Must be one of the following: IE, Firefox, Chrome or Safari");
            }
            browserProduct = product;

            switch (browserProduct)
            {
                case BrowserProduct.IE:
                    {
                        ieBrowser = new IEBrowser(uri, killExisting);
                        break;
                    }
                case BrowserProduct.Chrome:
                    {
                        chromeBrowser = new ChromeBrowser(uri,killExisting);
                        break;
                    }
                case BrowserProduct.Firefox:
                    {
                        firefoxBrowser = new FirefoxBrowser(uri, killExisting);
                        break;
                    }
                case BrowserProduct.Safari:
                    {
                        safariBrowser = new SafariBrowser(uri, killExisting);
                        break;
                    }
                default:
                    throw new Exception(String.Format("Code not implemented yet: {0}", product.ToString()));
            }
        }