/// <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); }
public void AttachOrCreate() { using (var browser = Firefox.AttachOrCreate()) { Assert.IsNotNull(browser); Console.WriteLine(browser.Id); browser.NavigateTo("http://localhost:8080"); browser.Elements.Count.Dump(); browser.ExecuteScript("window.location.href").Dump(); } }