コード例 #1
0
 public void TearDownFixture()
 {
     if (DriverPoolUsage == DriverPoolUsage.Fixture)
     {
         DriverPool.CloseAllForScope(this);
     }
 }
コード例 #2
0
        /// <summary>
        /// Use the driver pool with optionally resricting the pool with <paramref name="poolScopeObject"/>.
        /// </summary>
        /// <param name="builder">An <see cref="AtataContextBuilder"/>.</param>
        /// <param name="poolScopeObject">
        /// The pool scope object.
        /// Is optional.
        /// Mostly can be a fixture class object.
        /// When is <see langword="null"/> then will use whole global common pool;
        /// otherwise will use separate pool for particular scope object.
        /// </param>
        /// <returns></returns>
        public static AtataContextBuilder UseDriverPool(this AtataContextBuilder builder, object poolScopeObject = null)
        {
            IDriverFactory driverFactory = builder.BuildingContext.DriverFactoryToUse;

            RemoteWebDriver driver = DriverPool.Acquire(driverFactory, poolScopeObject);

            return(builder.UseDriver(driver).
                   OnCleanUp(ReleaseCurrentDriver));
        }
コード例 #3
0
        /// <summary>
        /// Use the driver pool with optionally restricting the pool with <paramref name="poolScopeObject"/>.
        /// </summary>
        /// <param name="builder">An <see cref="AtataContextBuilder"/>.</param>
        /// <param name="poolScopeObject">
        /// The pool scope object.
        /// Is optional.
        /// Mostly can be a fixture class object.
        /// When is <see langword="null"/> then will use whole global common pool;
        /// otherwise will use separate pool for particular scope object.
        /// </param>
        /// <returns>The same <see cref="AtataContextBuilder"/> instance.</returns>
        public static AtataContextBuilder UseDriverPool(this AtataContextBuilder builder, object poolScopeObject = null)
        {
            IDriverFactory driverFactory = builder.BuildingContext.DriverFactoryToUse;

            IWebDriver driver = DriverPool.Acquire(driverFactory, poolScopeObject);

            return(builder.UseDriver(driver)
                   .EventSubscriptions.Add <AtataContextCleanUpEvent>(ReleaseCurrentDriver));
        }
コード例 #4
0
 private static void ReleaseCurrentDriver()
 {
     DriverPool.Release(AtataContext.Current?.Driver);
 }
コード例 #5
0
 private static void ReleaseCurrentDriver(AtataContextCleanUpEvent eventData)
 {
     DriverPool.Release(eventData.Context.Driver);
 }
コード例 #6
0
 public void GlobalTearDown()
 {
     DriverPool.CloseAll();
 }