Beispiel #1
0
        /// <summary>
        /// Attach or create browsers for each type provided.
        /// </summary>
        /// <param name="type"> The type of the browser to attach to or create. </param>
        public static IEnumerable <Browser> AttachOrCreate(BrowserType type = BrowserType.All)
        {
            var response = new List <Browser>();

            if ((type & BrowserType.Chrome) == BrowserType.Chrome)
            {
                var chrome = Chrome.AttachOrCreate();
                response.Add(chrome);
            }

            //if ((type & BrowserType.Edge) == BrowserType.Edge)
            //{
            //	var edge = Edge.AttachOrCreate();
            //	response.Add(edge);
            //}

            if ((type & BrowserType.InternetExplorer) == BrowserType.InternetExplorer)
            {
                var explorer = InternetExplorer.AttachOrCreate();
                response.Add(explorer);
            }

            if ((type & BrowserType.Firefox) == BrowserType.Firefox)
            {
                var firefox = Firefox.AttachOrCreate();
                response.Add(firefox);
            }

            return(response);
        }
Beispiel #2
0
 public void AttachOrCreate()
 {
     using (var browser = Chrome.AttachOrCreate())
     {
         Assert.IsNotNull(browser);
         Console.WriteLine(browser.Id);
         browser.NavigateTo("http://localhost:8080");
         browser.Elements.Count.Dump();
         browser.ExecuteScript("window.location.href").Dump();
     }
 }