Beispiel #1
0
        /// <summary>
        /// Navigate to a uri by typing the uri in the browser's navigation edit box and pressing the {ENTER} key.
        /// </summary>
        /// <param name="uri">uri to navigate to.</param>
        public void Navigate(string uri)
        {
            switch (browserProduct)
            {
            case BrowserProduct.IE:
            {
                ieBrowser.Navigate(uri);
                break;
            }

            case BrowserProduct.Chrome:
            {
                chromeBrowser.Navigate(uri);
                break;
            }

            case BrowserProduct.Firefox:
            {
                firefoxBrowser.Navigate(uri);
                break;
            }

            case BrowserProduct.Safari:
            {
                safariBrowser.Navigate(uri);
                break;
            }

            default:
                throw new Exception(String.Format("Code not implemented yet: {0}", browserProduct.ToString()));
            }
        }
Beispiel #2
0
        public static int GetSupportedVersion(BrowserProduct browserProduct)
        {
            switch (browserProduct)
            {
            case BrowserProduct.IE:
            {
                return(IEBrowser.SupportedExeMajorVersion);
            }

            case BrowserProduct.Chrome:
            {
                return(ChromeBrowser.SupportedExeMajorVersion);
            }

            case BrowserProduct.Firefox:
            {
                return(FirefoxBrowser.SupportedExeMajorVersion);
            }

            case BrowserProduct.Safari:
            {
                return(SafariBrowser.SupportedExeMajorVersion);
            }

            default:
                throw new Exception(String.Format("Code not implemented yet: {0}", browserProduct.ToString()));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the full directory path of a Lynda.Test.Browsers.Browser.BrowserProduct
        ///  that is installed on the system.
        /// </summary>
        /// <param name="browserProduct">Browser to get the full directory path of.</param>
        /// <returns>Full directory path of the installed browser, or null if the browser is not installed.</returns>
        public static string GetInstalledExePath(BrowserProduct browserProduct)
        {
            switch (browserProduct)
            {
            case BrowserProduct.IE:
            {
                return(IEBrowser.InstalledExePath);
            }

            case BrowserProduct.Chrome:
            {
                return(ChromeBrowser.InstalledExePath);
            }

            case BrowserProduct.Firefox:
            {
                return(FirefoxBrowser.InstalledExePath);
            }

            case BrowserProduct.Safari:
            {
                return(SafariBrowser.InstalledExePath);
            }

            default:
                throw new Exception(String.Format("Code not implemented yet: {0}", browserProduct.ToString()));
            }
        }
Beispiel #4
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()));
            }
        }
Beispiel #5
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()));
            }
        }
Beispiel #6
0
 public static int GetSupportedVersion(BrowserProduct browserProduct)
 {
     switch (browserProduct)
     {
         case BrowserProduct.IE:
             {
                 return IEBrowser.SupportedExeMajorVersion;
             }
         case BrowserProduct.Chrome:
             {
                 return ChromeBrowser.SupportedExeMajorVersion;
             }
         case BrowserProduct.Firefox:
             {
                 return FirefoxBrowser.SupportedExeMajorVersion;
             }
         case BrowserProduct.Safari:
             {
                 return SafariBrowser.SupportedExeMajorVersion;
             }
      				default:
             throw new Exception(String.Format("Code not implemented yet: {0}", browserProduct.ToString()));
     }
 }
Beispiel #7
0
 /// <summary>
 /// Gets the full directory path of a Lynda.Test.Browsers.Browser.BrowserProduct
 ///  that is installed on the system.
 /// </summary>
 /// <param name="browserProduct">Browser to get the full directory path of.</param>
 /// <returns>Full directory path of the installed browser, or null if the browser is not installed.</returns>
 public static string GetInstalledExePath(BrowserProduct browserProduct)
 {
     switch (browserProduct)
     {
         case BrowserProduct.IE:
             {
                 return IEBrowser.InstalledExePath;
             }
         case BrowserProduct.Chrome:
             {
                 return ChromeBrowser.InstalledExePath;
             }
         case BrowserProduct.Firefox:
             {
                 return FirefoxBrowser.InstalledExePath;
             }
         case BrowserProduct.Safari:
             {
                 return SafariBrowser.InstalledExePath;
             }
      				default:
             throw new Exception(String.Format("Code not implemented yet: {0}", browserProduct.ToString()));
     }
 }