Example #1
0
        /// <summary>
        /// Attempts to attach to an existing browser.
        /// </summary>
        /// <returns> The browser instance or null if not found. </returns>
        public static Browser Attach(Process process)
        {
            if (process.ProcessName != BrowserName)
            {
                return null;
            }

            var session = GetSession() ?? StartSession();
            var application = Application.Attach(process, false);
            var browser = new Edge(application, session);
            browser.Refresh();
            return browser;
        }
Example #2
0
        /// <summary>
        /// Attempts to attach to an existing browser.
        /// </summary>
        /// <returns> An instance of an Internet Explorer browser. </returns>
        public static Browser Attach()
        {
            InitializeDriver();
            var session = GetSession() ?? StartSession();
            if (string.IsNullOrWhiteSpace(session))
            {
                return null;
            }

            var application = Application.Attach(BrowserName, null, false);
            var browser = new Edge(application, session);
            browser.Refresh();
            return browser;
        }
Example #3
0
 /// <summary>
 /// Creates a new instance of an Edge browser.
 /// </summary>
 /// <returns> An instance of an Edge browser. </returns>
 public static Browser Create()
 {
     InitializeDriver();
     var session = GetSession() ?? StartSession();
     var application = Application.Attach(BrowserName, null, false);
     var browser = new Edge(application, session);
     browser.Refresh();
     return browser;
 }