Esempio n. 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);
        }
Esempio n. 2
0
 public void Create()
 {
     using (var browser = Chrome.Create())
     {
         Assert.IsNotNull(browser);
         Console.WriteLine(browser.Id);
         browser.NavigateTo("http://localhost:8080");
         browser.Elements.Count.Dump();
         browser.ExecuteScript("window.location.href").Dump();
     }
 }
Esempio n. 3
0
        public void AttachToBrowser()
        {
            int processId;

            using (var browser1 = Chrome.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(Chrome), browser2.GetType());
            }
        }