/// <summary> /// Attach browsers for each type provided. /// </summary> /// <param name="type"> The type of the browser to attach to. </param> public static IEnumerable <Browser> AttachBrowsers(BrowserType type = BrowserType.All) { var response = new List <Browser>(); if ((type & BrowserType.Chrome) == BrowserType.Chrome) { response.Add(Chrome.Attach()); } if ((type & BrowserType.Edge) == BrowserType.Edge) { response.Add(Edge.Attach()); } if ((type & BrowserType.InternetExplorer) == BrowserType.InternetExplorer) { response.Add(InternetExplorer.Attach()); } if ((type & BrowserType.Firefox) == BrowserType.Firefox) { response.Add(Firefox.Attach()); } return(response); }
public void Attach() { using (var browser = Firefox.Create()) { Assert.IsNotNull(browser); } using (var browser = Firefox.Attach()) { Assert.IsNotNull(browser); Console.WriteLine(browser.Id); browser.NavigateTo("http://localhost:8080"); browser.Elements.Count.Dump(); browser.ExecuteScript("window.location.href").Dump(); } }
/// <summary> /// Attach process as a browser. /// </summary> /// <param name="process"> The process of the browser to attach to. </param> /// <returns> The browser if successfully attached or otherwise null. </returns> public static Browser AttachToBrowser(Process process) { return(Chrome.Attach(process) ?? Edge.Attach(process) ?? InternetExplorer.Attach(process) ?? Firefox.Attach(process)); }