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

            if ((type & BrowserType.Chrome) == BrowserType.Chrome)
            {
                response.Add(Chrome.Create());
            }

            //if ((type & BrowserType.Edge) == BrowserType.Edge)
            //{
            //	response.Add(Edge.Create());
            //}

            if ((type & BrowserType.InternetExplorer) == BrowserType.InternetExplorer)
            {
                response.Add(InternetExplorer.Create());
            }

            if ((type & BrowserType.Firefox) == BrowserType.Firefox)
            {
                response.Add(Firefox.Create());
            }

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

            using (var browser1 = Firefox.Create())
            {
                Assert.IsNotNull(browser1);
                processId = browser1.Application.Process.Id;
            }

            var process = Process.GetProcessById(processId);

            using (var browser2 = Browser.AttachToBrowser(process))
            {
                Assert.IsNotNull(browser2);
                Assert.AreEqual(typeof(Firefox), browser2.GetType());
            }
        }