Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDriverFactory"/>
 /// class. NOTE: This will use STANDALONE mode. It won't create a hub
 /// and node. This generally is quicker for running tests sequentially
 /// but slower for parallel stuff.
 /// </summary>
 public WebDriverFactory()
 {
     isStandalone   = true;
     disposedValue  = false;
     driverManager  = new DriverManager();
     trackedDrivers = new List <IWebDriver>();
     seleniumHub    = null;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebDriverFactory"/>
        /// class. NOTE: This will create a hub and node process for better
        /// performance when running tests in parallel.
        /// </summary>
        /// <param name="seleniumHubOptions">The selenium hub options.</param>
        /// <param name="seleniumNodeOptions">The selenium node options.</param>
        /// <exception cref="ArgumentNullException">
        /// seleniumHubOptions
        /// or
        /// seleniumNodeOptions
        /// </exception>
        /// <exception cref="Exception">
        /// Failed to start the hub process.
        /// or
        /// Failed to start the node process.
        /// </exception>
        public WebDriverFactory(
            SeleniumHubOptions seleniumHubOptions,
            SeleniumNodeOptions seleniumNodeOptions)
        {
            if (seleniumHubOptions == null)
            {
                throw new ArgumentNullException(nameof(seleniumHubOptions));
            }
            else if (seleniumNodeOptions == null)
            {
                throw new ArgumentNullException(nameof(seleniumNodeOptions));
            }

            isStandalone   = false;
            disposedValue  = false;
            driverManager  = new DriverManager();
            trackedDrivers = new List <IWebDriver>();
            seleniumHub    = new SeleniumHub(seleniumHubOptions);

            seleniumHub.StartProcess();
            seleniumHub.RegisterNode(seleniumNodeOptions);
        }
Example #3
0
 public void TestInitialize()
 {
     seleniumHub = new SeleniumHub();
 }